From:             pigo at ms5 dot url dot com dot tw
Operating system: RedHat 8.0 Kernel 2.4.20
PHP version:      4.3.9
PHP Bug Type:     OpenSSL related
Bug description:  This function can't encrypt large data when data length more 
than key size

Description:
------------
This function can't encrypt large data when data length more than key
size

I get error :
encrypt error : string(84) "error:0406D06E:rsa
routines:RSA_padding_add_PKCS1_type_2:data too large for key size"

Reproduce code:
---------------
        $privkey = openssl_pkey_new();
        $csr = openssl_csr_new($GLOBALS["_CONFIG"]["key_dn"], $privkey);
        $sscert = openssl_csr_sign($csr, null, $privkey, 365);
        openssl_csr_export($csr, $csrout);
        openssl_x509_export($sscert, $public_key ) ;
        openssl_pkey_export($privkey, $private_key);
$log_data="B,1,1,1,1,1234,0001,AAA012,0001,0008,0000,0005,Y,Y,Y,Y,0779,071504,S1,PP01,M01,20040715073,1B,1,1,1,1,1234,0001,AAA012,0001,0007,0000,0006,Y,Y,Y,Y,0679,071504,S1,PP01,M01,200407150843,2B,1,1,1,1,1234,0001,AAA015,0002,0005,0000,0008,Y,Y,Y,Y,0899,071504,S1,PP01,M01,200407150856,3B,1,1,1,1,1234,0001,AAA015,0001,0004,0000,0009,Y,Y,Y,Y,1199,071504,S1,PP01,M01,200407150857,4";
$PK = openssl_get_publickey( $server_public_key );
if(!openssl_public_encrypt($log_data , $crypttext , $PK ))
{
        echo "encrypt error : " ;
        var_dump(openssl_error_string() );
}


-- 
Edit bug report at http://bugs.php.net/?id=30757&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30757&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30757&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30757&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30757&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30757&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30757&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30757&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30757&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30757&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30757&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30757&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30757&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30757&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30757&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30757&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30757&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30757&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30757&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30757&r=mysqlcfg

Reply via email to