unable to load private key

754 views
Skip to first unread message

surya t

unread,
Apr 15, 2012, 10:05:14 PM4/15/12
to Crypto++ Users
I have created the private key using openssl command
openssl genrsa -out ca.key 1024

but when I tried to load the same it is giving exception. I am using
LoadKey function to load the private key

string str("ca.key");
RSA::PrivateKey prkey;
LoadKey(str, prkey);
.......
......

Definition for LoadKey
void LoadKey( const string& filename, RSA::PrivateKey& PrivateKey )
{
// DER Encode Key - PKCS #8 key format
PrivateKey.Load(
FileSource( filename.c_str(), true, NULL, true /
*binary*/ ).Ref()
);
}
can anyone tell me what is the issue?

surya t

unread,
Apr 16, 2012, 12:03:59 AM4/16/12
to Crypto++ Users
I got it?

The Private key should be in DER format which is given in the below
link

http://stackoverflow.com/questions/9815001/load-pem-encoded-private-rsa-key-in-crypto

Jeffrey Walton

unread,
Apr 16, 2012, 11:41:06 PM4/16/12
to Crypto++ Users
Reply all
Reply to author
Forward
0 new messages