Hi David, > I cannot for the life of me figure out an easy way to read the public > key PEM file into cryptopp to decrypt a message encrypted via > openssl_private_encrypt. Can I read a PEM format openssl generated > public key using a cryptopp one-liner...? And then easily decrypt > something encrypted in php with openssl_private_encrypt? > You've got 3 options here:
1. Add -outform der to the command that emits the public key. 2. Use a text editor to delete the lines that have the dashes, then use a Base64Decoder. 3. Write a simple filter to ignore the ----- BEGIN OBJECT ----- and ----- END OBJECT ----- lines. I've posted an example for how you might do (3) here: http://cryptopp.pastebin.com/f446c0f2c Though I use that and it works, I couldn't attest to its robustness with a wide variety of inputs... I use it for stuff that I control and that I produce with OpenSSL. It expects your header and footer lines to always have 10 dashes. I'm not really familiar with the openssl_private_encrypt function in PHP, but it sounds like it only makes sense for signatures. If you're padding properly in your PHP code and just signing SHA1 hashes, use RSASSA_PKCS1v15_SHA_Verifier. If you're not, I think you'll have to work at a lower level than most of the samples show. HTH, Geoff --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
