[Botan-devel] Deriving public key from PEM-encoded private key

Z. S. O. tiredashell at gmail.com
Thu Feb 26 22:39:04 EST 2009


Hi, I've got another usage-related question if you don't mind. I'm using RSA
and I want to create two simple functions:

std::string GenPrivateKey()
std::string GenPublicKey(std::string privateKey)

The first one generates a private key and returns its PEM-encoded string.
Then, the second takes that string, derives the equivalent public key, and
returns its PEM-encoded string.

My problem is that while it's easy to go from RSA_PrivateKey to std::string,
I'm not sure how to make the second function because I have no idea how to
go from std::string to RSA_PrivateKey. I need to have it in that form in
order to perform X509::PEM_encode to generate the public key.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20090226/75b71822/attachment.html>


More information about the botan-devel mailing list