Using elgamal encryption with a specific (multiplicative) group.
d.brentjes at gmail.com
Mon Oct 24 15:34:23 CEST 2016
I've been looking at the library and am trying to use it for elgamal
encryption and decryption. So first step is to generate a keypair.
error = gcry_sexp_build(&key_generator, &parse_error_offset, "(genkey
(%s (nbits %s)))", "elg", "2048");
error = gcry_pk_genkey(&key_pair, key_generator);
I took a quick peek in the code and this finds a prime and generator to
use for the encryption and decryption. But I want to supply my own.
So I found that you can use a s-expr "(genkey (algo (domain (p ...) (q
...) (g ...))))" with gcry_pk_genkey, but this only works on DSA
Now I have succesfully gcry_mpi_scan'ed my desired p,q and g (from
rfc5114), But I have no idea how to securely generate a private key for
this group using the gcrypt facilities.
And can I use the MPI facilty after that to calculate the public key (as
long as my private key is stored in secure memory)?
More information about the Gcrypt-devel