Creating a key without using a random key generator.

Heather Shaw heathjs21 at yahoo.com
Fri Aug 12 16:50:18 CEST 2005


If I am given a key to use for generating a message
digest of a buffer, how do I create a key manually to
pass into the gcry_md_setkey() without using the
routines to randomly generate a key and then pass it
in.

Right now for my test example, I am using
gcry_sexp_new(&key_spec, "(genkey (rsa (nbits
4:1028)))", 0 ,1) and calling the gcry_pk_genkey.  I
am then stripping out the public and private key and
using the public key as my key.  *I know there
probably was an easier way, but I just found this
example and it was faster for me.*

My test code to create the message digest is calling
gcry_md_open() with all the necessary params and then
calling gcry_md_setkey () with the key I found above. 


Thanks for your help!  I am sure it is something
pretty trivial....



More information about the Gnupg-devel mailing list