I can convert the BER encoded private key file to openPGP easily
enough, but converting from openPGP to a BER encoded file is difficult
because it doesn't have the dmp1 (m_dp) and dmq1 (m_dq) values stored.
I really don't want to have to write my own functions to compute them.
Is there a way to read/write directly to an openPGP compatible format?
Crypto++ uses BER encoding to read and write the public key in X509,
and the private key in PKCS#8. I need to read and write ascii armored
files, which I know how to do independently, but I don't know how to
use them with crypto++.
I could actually do it the hard way and convert the formats externally,
except that I would have to do the aforementioned math. Once I get
into implementing parts of the RSA algorithm, I think I'm going too
far, and I need to figure out how I was supposed to do it within the
library, and that's the question.
> ...because it doesn't have the dmp1 (m_dp) and dmq1 (m_dq)
> values stored.
It's part of the private key (p and q). Is Load() throwing and error?
Forgive my ignorance - I've never tried to load a PGP key. But I
thought Crypto++ has PGP support (though I don't know all the
details).
I recently tried the encoding/decoding. See
http://groups.google.com/group/cryptopp-users/browse_frm/thread/3fb20aaa9b71de8c/b0f9438b7feba5e7?hl=en&
For a private key, call Load() on an decryptor (I'm not sure if an
Encryption object has the other parameters besides the public
exponent).
Jeff
Crypto++ provides a function to compute p and q given just n, e, and d.
It's the third Initialize() function of InvertibleRSAFunction class in
rsa.h.