The RSA private keys generated by Crypt++ version 4.2 are in the format specified by PKCS #1: RSA Cryptographic Standard, June 14, 2002. This format is an ASN.1 / BER Sequence containing a few small integers and seven large integers. The RSA private keys generated by Crypt++ version 5.2.1 are in the format specified by PKCS #8: Private-key Information Syntax Standard, RSA Laboratories Technical Note, November 1, 1993. This format is also an ASN.1 / BER Sequence containing a version number, an algorithm identifier, and private key encoded as octet-string. This private key is the key defined by PKCS #1.
Crypt++ 4.2 contains code to check select element of the BER sequence for type INTEGER, and if so, load the PKCS #1 key. Otherwise it validates the PKCS #8 envelope, then loads embedded key. This code is not seem to appear anywhere in Crypt 5.2.1.
I have written a few C++ classes to parse an ANS.1 / BER encoding into a tree of objects and to encode such as tree back to ASN.1 / BER, including a method to wrap an PKCS #1 with the correct gook to transform it into a proper PKCS #8 key.
If anyone comes back into this ghost town looking for a similar solution, I'd be happy to make the classes available under the standard no-warranty disclaimers. The classes do using a new modules that I'm not in a position to give away, so a little tweaking would be required before they could be used directly. They are, however, blessedly free of C++ template abuse.
I feel a little like a lost explorer scatching his story in the remains of a lost civilization.
--
Jim Starkey Netfrastructure, Inc. 978 526-1376
