View Full Version : What could be wrong with my SSL encrypt call?

05-18-2011, 02:22 AM
Hi all. I'm having problems encrypting with RSA. To troubleshoot, I just wanted to encrypt a test string. But the resulting encrypted string 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!

$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");