Thanks very much, that worked.
On Wed, Sep 11, 2019 at 10:56 PM Wim Lewis <w...@omnigroup.com> wrote: > > > On Sep 11, 2019, at 3:31 AM, Chitrang Srivastava < > chitrang.srivast...@gmail.com> wrote: > > 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); > > I don't think that PEM_write_bio_PrivateKey() will compute the key length > for you if you pass 0. If you pass klen=0 it will encrypt with a 0-byte > key. Try passing strlen(PKeyPassPKCS12) for klen and see if that helps. > > >