Hi!

I am doing a SHA256 on a RSA* private key. I used the result as a symmetric
key for AES encryption.

///////////////////////////////////////////////////////////////////////////////////////////
int length = RSA_size(rsaPrivateKey);

SHA256_CTX sha256ctx;
SHA256_Init(&sha256ctx);
SHA256_Update(&sha256ctx, rsaPrivateKey, length);

unsigned char* hash = new unsigned char[SHA256_DIGEST_LENGTH];

SHA256_Final(hash, &sha256ctx);
///////////////////////////////////////////////////////////////////////////////////////////

If I execute this code couples of time in the same process execution, hash
variable is always the same value (this is normal!!). 
But, each time I restart the application, hash value is different.

In the past I used the same pattern, with SHA512 instead of SHA256, and with
a char* instead of a RSA* and I dit not have this problem.

Any idea what's going on ?
-- 
View this message in context: 
http://www.nabble.com/Question-about-SHA256-on-a-RSA*-key-tp21093222p21093222.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to