EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Save X509 private key to PEM without password

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#31218
Posted: 10/31/2014 03:43:17
by Stephane Grobety (Priority Standard support level)
Joined: 04/18/2006
Posts: 170

Hello,

I'm attempting to save the private key of an X509 certificate in DER format without any encryption or password (so that it can be loaded by a web host). basically, I'm trying to duplicate the OpenSSL command
Code
openssl genrsa -out privkey.pem 2048


I'm using this call to perform the deed:

Code
ACert.SaveKeyToStreamPKCS8(AKeyStream, '')


Unfortunately, this result in the following :

Code
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,A88B79298DA23C75

{key data}
-----END RSA PRIVATE KEY-----


When I was expecting this:

Code
-----BEGIN RSA PRIVATE KEY-----
{key data}
-----END RSA PRIVATE KEY-----


Is there another way to do what I'd like to do ?

Thanks a lot
#31220
Posted: 10/31/2014 03:49:39
by Eugene Mayevski (EldoS Corp.)

Please call
Code
SaveKeyToStreamPEM(Stream, SB_ALGORITHM_CNT_IDENTITY, cmCBC, passphrase);


Sincerely yours
Eugene Mayevski
#31221
Posted: 10/31/2014 03:50:34
by Eugene Mayevski (EldoS Corp.)

BTW you seem to be using not the latest build of SecureBlackbox. In the latest builds we've changed the old behavior and now empty password means "no encryption" instead of "encryption with empty password".


Sincerely yours
Eugene Mayevski
#31223
Posted: 10/31/2014 03:58:31
by Stephane Grobety (Priority Standard support level)
Joined: 04/18/2006
Posts: 170

Thanks a lot for the quick answer. That worked like a charm (even though I quoted the wrong code: I'm using ACert.SaveKeyToStreamPEM(AKeyStream, ''))


Quote
BTW you seem to be using not the latest build of SecureBlackbox


That's weird: I updated yesterday. Here is what I have in Changes.txt:

SecureBlackbox - version 12.0.262 - Released October 28, 2014

Thanks a lot for the (as always) excellent and timely support

Reply

Statistics

Topic viewed 416 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!