Thanks Rich and Tomas,
Here is the code for creating the key (openssl-0.9.8h)
int AESCipher::createKey(unsigned char *buf, int keySize) {
char seed[256];
::sprintf(seed, "%ldXXX_XXX_H__xxxxx_xxxx_xxx_xxxxx_xxxxxxx__INCLUDED_", MiscUtils::generateId());
RAND_seed(seed, ::strlen(seed));
RAND_bytes(buf, keySize / 8);
return keySize / 8;
}
::sprintf(seed, "%ldXXX_XXX_H__xxxxx_xxxx_xxx_xxxxx_xxxxxxx__INCLUDED_", MiscUtils::generateId());
RAND_seed(seed, ::strlen(seed));
RAND_bytes(buf, keySize / 8);
return keySize / 8;
}
For using 1.1.0, we only need to call RAND_bytes() ?
Jason
On Wed, Nov 13, 2019 at 12:11 PM Salz, Rich <rsalz@xxxxxxxxxx> wrote:
> RAND_seed(seed, ::strlen(seed));
> RAND_bytes(buf, keySize / 8);
I don’t know where you are getting the seed, but it is typically binary data, not a C string.
If you are using 1.1.0 or later, you do not need to seed things.