What could be wrong with my SSL encrypt call?
Posted: Tue May 17, 2011 7:13 pm
Hi all. I'm having problems encrypting with RSA on both the client and server side. To troubleshoot, I just wanted to encrypt a test string. But the resulting encrypted version is empty, no matter what I do.
The public key here ($pubKey) is good; I had additional lines to test whether it was null. Thanks for any insight!
The public key here ($pubKey) is good; I had additional lines to test whether it was null. Thanks for any insight!
Code: Select all
$pubKey = openssl_get_publickey($pubKeyPEM);
$fh = fopen("encryptIDTest.log", 'w') or die("can't open file");
openssl_public_encrypt("D4DD101E-7BC0-4B97-A111-CBD62F908581", $pubEncrypted, $pubKey, OPENSSL_PKCS1_OAEP_PADDING);
fwrite($fh, "Test ID encrypted: {$pubEncrypted}\n");
fclose($fh);