include/beecrypt/elgamal.h File Reference

ElGamal algorithm. More...

#include "beecrypt/mpbarrett.h"

Include dependency graph for elgamal.h:

Go to the source code of this file.

Functions

BEECRYPTAPI int elgv1sign (const mpbarrett *p, const mpbarrett *n, const mpnumber *g, randomGeneratorContext *, const mpnumber *hm, const mpnumber *x, mpnumber *r, mpnumber *s)
 This function performs raw ElGamal signing, variant 1.
BEECRYPTAPI int elgv3sign (const mpbarrett *p, const mpbarrett *n, const mpnumber *g, randomGeneratorContext *, const mpnumber *hm, const mpnumber *x, mpnumber *r, mpnumber *s)
 This function performs raw ElGamal signing, variant 3.
BEECRYPTAPI int elgv1vrfy (const mpbarrett *p, const mpbarrett *n, const mpnumber *g, const mpnumber *hm, const mpnumber *y, const mpnumber *r, const mpnumber *s)
 This function performs raw ElGamal verification, variant 1.
BEECRYPTAPI int elgv3vrfy (const mpbarrett *p, const mpbarrett *n, const mpnumber *g, const mpnumber *hm, const mpnumber *y, const mpnumber *r, const mpnumber *s)
 This function performs raw ElGamal verification, variant 3.


Detailed Description

ElGamal algorithm.

For more information on this algorithm, see: "Handbook of Applied Cryptography", 11.5.2: "The ElGamal signature scheme", p. 454-459

Two of the signature variants in Note 11.70 are implemented.

Todo:
Implement ElGamal encryption and decryption.
Todo:
Explore the possibility of using simultaneous multiple exponentiation, as described in HAC, 14.87 (iii).
Author:
Bob Deblier <bob.deblier@telenet.be>

Function Documentation

int elgv1sign ( const mpbarrett p,
const mpbarrett n,
const mpnumber g,
randomGeneratorContext rgc,
const mpnumber hm,
const mpnumber x,
mpnumber r,
mpnumber s 
)

This function performs raw ElGamal signing, variant 1.

Signing equations:

  • $r=g^{k}\ \textrm{mod}\ p$
  • $s=k^{-1}(h(m)-xr)\ \textrm{mod}\ (p-1)$
Parameters:
p The prime.
n The reducer mod (p-1).
g The generator.
rgc The pseudo-random generat
hm The hash to be signed.
x The private key value.
r The signature's r value.
s The signature's s value.
Return values:
0 on success.
-1 on failure.

int elgv1vrfy ( const mpbarrett p,
const mpbarrett n,
const mpnumber g,
const mpnumber hm,
const mpnumber y,
const mpnumber r,
const mpnumber s 
)

This function performs raw ElGamal verification, variant 1.

Verifying equations:

  • Check $0<r<p$ and $0<s<(p-1)$
  • $v_1=y^{r}r^{s}\ \textrm{mod}\ p$
  • $v_2=g^{h(m)}\ \textrm{mod}\ p$
  • Check $v_1=v_2$
Parameters:
p The prime.
n The reducer mod (p-1).
g The generator.
hm The hash to be signed.
y The public key value.
r The signature's r value.
s The signature's s value.
Return values:
1 on success.
0 on failure.

int elgv3sign ( const mpbarrett p,
const mpbarrett n,
const mpnumber g,
randomGeneratorContext rgc,
const mpnumber hm,
const mpnumber x,
mpnumber r,
mpnumber s 
)

This function performs raw ElGamal signing, variant 3.

Signing equations:

  • $r=g^{k}\ \textrm{mod}\ p$
  • $s=xr+kh(m)\ \textrm{mod}\ (p-1)$
Parameters:
p The prime.
n The reducer mod (p-1).
g The generator.
rgc The pseudo-random generat
hm The hash to be signed.
x The private key value.
r The signature's r value.
s The signature's s value.
Return values:
0 on success.
-1 on failure.

int elgv3vrfy ( const mpbarrett p,
const mpbarrett n,
const mpnumber g,
const mpnumber hm,
const mpnumber y,
const mpnumber r,
const mpnumber s 
)

This function performs raw ElGamal verification, variant 3.

Verifying equations:

  • Check $0<r<p$ and $0<s<(p-1)$
  • $v_1=g^{s}\ \textrm{mod}\ p$
  • $v_2=y^{r}r^{h(m)}\ \textrm{mod}\ p$
  • Check $v_1=v_2$
Parameters:
p The prime.
n The reducer mod (p-1).
g The generator.
hm The hash to be signed.
y The public key value.
r The signature's r value.
s The signature's s value.
Return values:
1 on success.
0 on failure.


Generated on Fri Jun 19 13:38:51 2009 for BeeCrypt by  doxygen 1.5.8