0

Basically My application decrypt an encrypted image, as part of that process I am invoking couple of openssl API's in a series.

BIO *mem = NULL;
RSA *prsa = NULL;
pem_password_cb *cb = .... ( Note it points a valid function -- static int gen_cb(char *buf, int size, int rwflag, void *u))
mem = BIO_new_mem_buf(key, -1); //Note : key pointing to my key buffer it was a valid one.
PEM_read_bio_RSAPrivateKey(mem, NULL, cb, NULL);

I kepts couple of logs , As soon as I call PEM_read_bio_RSAPrivateKey(), I see the following messages. enter image description here

This was a working code, and i am porting as-is my appliction to to openbmc ( note openssl version -1.1.1g)

Matt Caswell
  • 8,167
  • 25
  • 28
  • Using the `openssl errstr` application you can get a human readable error string from the error code: "error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt", "error:23077074:PKCS12 routines:PKCS12_pbe_crypt:pkcs12 cipherfinal error", "error:2306A075:PKCS12 routines:PKCS12_item_decrypt_d2i:pkcs12 pbe crypt error", "error:0907B00D:PEM routines:PEM_read_bio_PrivateKey:ASN1 lib". The errors indicate a problem in the password based decryption. Most likely the password is wrong. Does your password callback get called? – Matt Caswell Jul 27 '23 at 12:39
  • Thanks, I added logs in my call back function, seems the call back is not getting called. After properly mapping to the right call back function. Things are working. – chandu reddy Jul 27 '23 at 18:48

0 Answers0