Hello,
I am trying to write a function which transforms a DER-formatted Crypto++ RSA *PUBLIC* key into its OpenSSL PEM counterpart.
I saw some hints on the Crypto++ FAQ this page:
http://www.eskimo.com/~weidai/cgi-bin/fom-serve/cache/62.html
Unfortunately, while it works very well for the *PRIVATE* key, it doesn't seem to be able to convert the PUBLIC one.
Here's what I get from OpenSSL:
$ openssl pkcs8 -in pub.der -inform DER -out pub.pem -nocrypt
Error decrypting key
31109:error:0D080071:asn1 encoding routines:d2i_ASN1_INTEGER:expecting an integer:a_int.c:204:
31109:error:0D0FA004:asn1 encoding routines:d2i_PKCS8_PRIV_KEY_INFO:nested asn1 error:p8_pkey.c:106:address=135556640 offset=3
If you take a look into the error message you will see that apparently OpenSSL tries to transform it as a PRIVATE key, not a public one.
Any idea is of course welcome,
Adrian Petru Dimulescu;
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
