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

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to