I've been using a private/public key pair for awhile now and I'd like to see
if I can get them to work in PHP (using OpenSSL).  The keys I have are in
binary format, with no header info in them.

For Crypto++ I would use the key to verify a sig like so (key data is in
pbData)

StringSource keysPub((byte*)pbData, pubkeysize, true);
RSASSA_PKCS1v15_MD5_Verifier rsaPub(keysPub);
if (rsaPub.VerifyMessage((byte*)Z_STRVAL(slic), Z_STRLEN(slic), pbrevsig,
Z_STRLEN(ssig)))

I would sign the data like so:

        StringSource keys((byte*)pbData, dwSize, true);
        RSASSA_PKCS1v15_MD5_Signer rsaPriv(keys);
        int iLen = rsaPriv.SignatureLength();
        byte* out = new byte[iLen];
        unsigned int signatureLength = rsaPriv.SignMessage(GlobalRNG(),
(byte *)pStr, strlen(pStr), out);

Is there a way to take these binary keys and convert them to a base64 format
(or whatever format) that openssl would recognize?

Thanks!

Michael 

Reply via email to