3 eggen, egencrypt, egdecrypt, egsign, egverify, egpuballoc, egpubfree, egprivalloc, egprivfree, egsigalloc, egsigfree, egprivtopub - elgamal encryption
11 .B #include <libsec.h>
14 EGpriv* eggen(int nlen, int nrep)
17 mpint* egencrypt(EGpub *k, mpint *in, mpint *out)
20 mpint* egdecrypt(EGpriv *k, mpint *in, mpint *out)
23 EGsig* egsign(EGpriv *k, mpint *m)
26 int egverify(EGpub *k, EGsig *sig, mpint *m)
29 EGpub* egpuballoc(void)
32 void egpubfree(EGpub*)
35 EGpriv* egprivalloc(void)
38 void egprivfree(EGpriv*)
41 EGsig* egsigalloc(void)
44 void egsigfree(EGsig*)
47 EGpub* egprivtopub(EGpriv*)
50 Elgamal is a public key encryption and signature algorithm. The owner of a key publishes
51 the public part of the key:
56 mpint *alpha; // generator
57 mpint *key; // (encryption key) alpha**secret mod p
60 This part can be used for encrypting data (with
62 to be sent to the owner.
63 The owner decrypts (with
65 using his private key:
70 mpint *secret; // (decryption key)
74 Keys are generated using
77 takes both bit length of the modulus
78 and the number of repetitions of the Miller-Rabin
79 primality test to run. If the latter is 0, it does the default number
82 returns a newly allocated copy of the public key
83 corresponding to the private key.
91 are provided to manage key storage.
106 returns 0 if the signature is valid and \-1 if not.
112 are provided to manage signature storage.