AES 256 bit key generation
Rubis Paul
rubis.paul at gmail.com
Thu Aug 10 19:47:22 CEST 2006
Hi all,
I want to create as AEs key of size 256 bits.is there any function in
libgcrypt to generate AES key ?
Now i am using libgcrypt random number generation to create an AES key
.is this correct ?
I am sedning my code
//Symmetric key generation (128 bit)
printf("Generating symmetric key (128 bit)...\n");
//Allocate a byte-array for holding the key
unsigned char* key = (unsigned char*) malloc(BLOCKSIZE*sizeof(char));
//Use secure random number generation
gcry_randomize(key, BLOCKSIZE, GCRY_STRONG_RANDOM);
printf("Setting the key...\n");
err = gcry_cipher_setkey(hd, key, BLOCKSIZE);
is this the corret way of generating AES key ?
what is the best mode of AES encryption ( like , GCRY_CIPHER_MODE_CFB, etc) ?
Thanks
Rubis
More information about the Gnupg-users
mailing list