PrivateKey Decrypt Failure
Chitrang Srivastava
chitrang.srivastava at gmail.com
Wed Sep 11 10:31:15 UTC 2019
Hi,
I am using openssl 1.1.1b and I am storing private key encrypted.
I am storing private key as
*PEM_write_bio_PrivateKey*(bio, pkey, EVP_aes_128_cbc(), PKeyPassPKCS12, 0,
0, NULL);
and on system startup reading using the following way
if(!*PEM_read_bio_PrivateKey*(keyBIO, &user_s_key, NULL,
decryptSharedSecret))
Upon debugging I found it is failing in PKCS12_pbe_crypt >
*EVP_CipherFinal_ex*
Please suggest where I am doing wrong?
Could this be appear to related to padding ?
Without encryption of key , it works fine , which clear other code is all
fine.
Thanks,
*evp_enc.c:EVP_DecryptFinal_ex:569*
/*
* The following assumes that the ciphertext has been authenticated.
* Otherwise it provides a padding oracle.
*/
n = ctx->final[b - 1];
if (n == 0 || n > (int)b) {
* EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_BAD_DECRYPT);*
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190911/8d1109e6/attachment.html>
More information about the openssl-users
mailing list