From:             ly...@php.net
Operating system: CentOS 2.6.18
PHP version:      5.3.26
Package:          OpenSSL related
Bug Type:         Bug
Bug description:openssl_private_encrypt OAEP only works AFTER PKCS1

Description:
------------
A call to openssl_private_encrypt(..., OPENSSL_PKCS1_OAEP_PADDING) fails
unless you call it AFTER openssl_private_encrypt(...,
OPENSSL_PKCS1_PADDING)


Test script:
---------------
$private_key_text = file_get_contents('private.pem');

openssl_private_encrypt($decrypted_message, $encrypted_message,
$private_key_text, OPENSSL_PKCS1_OAEP_PADDING);
echo "PKCS1_OAEP fails:\n";
var_dump(base64_encode($encrypted_message));
echo "\n";


openssl_private_encrypt($decrypted_message, $encrypted_message,
$private_key_text, OPENSSL_PKCS1_PADDING);
echo "PKCS1 works:\n";
var_dump(base64_encode($encrypted_message));
echo "\n";


openssl_private_encrypt($decrypted_message, $encrypted_message,
$private_key_text, OPENSSL_PKCS1_OAEP_PADDING);
echo "PKCS1_OAEP works only AFTER PKCS1:\n";
var_dump(base64_encode($encrypted_message));
echo "\n";



Expected result:
----------------
All three outputs the same.

Actual result:
--------------
First output is blank string.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65193&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65193&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65193&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65193&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65193&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65193&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65193&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65193&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65193&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65193&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65193&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65193&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65193&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65193&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65193&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65193&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65193&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65193&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65193&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65193&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65193&r=mysqlcfg

Reply via email to