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