Hi Dave, Thank you very much for a prompt response. I very much appreciate your inputs. I have a couple of follow up questions. You mentioned that the output would be different between openssl 0.9.8 and 1.0.1x versions as the following methods are being used in the code flow for the method PEM_write_bio_PrivateKey. 1.0.1x - PEM_write_bio_PKCS8PrivateKey 0.9.8 - PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,...) 1. As I mentioned earlier, We have a sample application where we try to read a sample pem key file, create an EVP_PKEY indirectly using PEM_read_bio_PrivateKey and try to create pem key files encrypted using different ciphers like (RC2, RC4 etc.) using the method PEM_write_bio_PrivateKey. I am getting a different output in 1.0.1x while using the cipher RC2 by using the method PEM_write_bio_PrivateKey.That is understandable as we use PKCS8 in 1.0.1x. However if I try to use the cipher RC4 for encyrption,PEM_write_bio_PKCS8PrivateKey is failing.Is there a known issue or a bug for RC4. 2. Also Can I use the method PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,...) in 1.0.1x instead of the method PEM_write_bio_PrivateKey if I want to have the same output similar to 0.9.8. Thanks in advance for your hlep. Regards, -Jaya Nageswar. On Mon, Dec 22, 2014 at 6:27 PM, Dave Thompson <dthompson at prinpay.com> wrote: > > From: openssl-users On Behalf Of Jaya Nageswar > > Sent: Monday, December 22, 2014 05:51 > > > In our application, we have been using openssl 0.9.8 and trying to move > to > > openssl 1.0.1x as 0.9.8 is going to be EOS by December 2015. We have a > > sample application where we try to read a sample pem key file, create an > > EVP_PKEY indirectly using PEM_read_bio_PrivateKey [and] try to create > > pem key files encrypted using different ciphers like (RC2, RC4 etc.). > > <snip lots of mechanism> > > The mechanism was refactored some, but the visible change is deliberate. > > There have long been routines for the algorithm-specific "traditional" > formats PEM_read/write_RSAPrivateKey/DSAPrivateKey/ECPrivateKey > AND for the newer standard and algorithm-generic PKCS8 format > PEM_read/write_PKCS8PrivateKey. > > Through 0.9.8 PEM_write_PrivateKey used (the appropriate one of) > traditional formats; in 1.0.0 and later it changed to use PKCS8. > If you want to continue writing traditional formats in 1.0.0+ call > specifically _write_RSAPrivateKey, _write_DSAPrivateKey, etc. > using the algorithm-specific struct from (instead of) EVP_PKEY. > > At least for now; there is another thread started just a few days ago > about all PEM formats used by OpenSSL suggesting the traditional > privatekey forms are obsolete and maybe should be deleted! > > Note all PEM_read_xyzPrivateKey routines can read *either* > format, legacy or PKCS8, distinguished by the BEGIN line, although > if e.g. you _read_RSAPrivateKey and the file is PKCS8 for *another* > algorithm that's an error; if you _read_PKCS8PrivateKey it accepts > any algorithm into an EVP_PKEY. > > If you are writing differently-encrypted privatekey files because > you are concerned with key security, note one reason PKCS8 > encrypted is preferred over traditional encrypted formats is > that PKCS8 allows and OpenSSL uses a much stronger PBE > key derivation compared to the older and weaker but > now set in stone and unchangeable one for traditional. > > On checking I see the PEM_most manpage has not > been updated for this change. > > > _______________________________________________ > openssl-users mailing list > openssl-users at openssl.org > https://mta.opensslfoundation.net/mailman/listinfo/openssl-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mta.opensslfoundation.net/pipermail/openssl-users/attachments/20141230/33a908a3/attachment.html>