ELGAMAL(2)ELGAMAL(2)
NAME
eggen, egencrypt, egdecrypt, egsign, egverify, egpuballoc, egpubfree, egprivalloc, egprivfree, egsigalloc, egsigfree, egprivtopub - elgamal encryption
SYNOPSIS
EGpriv* eggen(int nlen, int nrep)
mpint* egencrypt(EGpub *k, mpint *in, mpint *out)
mpint* egdecrypt(EGpriv *k, mpint *in, mpint *out)
EGsig* egsign(EGpriv *k, mpint *m)
int egverify(EGpub *k, EGsig *sig, mpint *m)
EGpub* egpuballoc(void)
void egpubfree(EGpub*)
EGpriv* egprivalloc(void)
void egprivfree(EGpriv*)
EGsig* egsigalloc(void)
void egsigfree(EGsig*)
EGpub* egprivtopub(EGpriv*)
DESCRIPTION
Elgamal is a public key encryption and signature algorithm. The owner of a key publishes the public part of the key:
struct EGpub { mpint *p; // modulus mpint *alpha; // generator mpint *key; // (encryption key) alpha**secret mod p };
This part can be used for encrypting data (with
struct EGpriv { EGpub pub; mpint *secret; // (decryption key) };
Keys are generated using
The routines
struct EGsig { mpint *r, *s; };
The routines