openssl_get_privatekey breaks output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    openssl_get_privatekey breaks output

    Hi,

    I have a weird problem using openssl_get_pri vatekey. I use this
    function to decrypt some records from a database. The first two get
    decrypted fine, but at the third function call, openssl_get_pri vatekey
    returns false and the script stops outputting, with this error string:

    error:0407106B: rsa routines:RSA_pa dding_check_PKC S1_type_2:block type
    is not 02

    I use PHP 4.2.3 with openssl 0.9.6e

    Any ideas?

    Alex
  • Alex

    #2
    Re: openssl_get_pri vatekey breaks output

    For the records and because I hate finding messages with no answer:
    this problem was caused by the transfer to the database. I suspect
    some magic quotes or whatever to have altered the data. Therefore
    decryption failed and caused this error.

    Solution: use base64_encode($ encrypted_data) before putting the data
    into the db and base64_decode before decrypting.



    adugarry@hotmai l.com (Alex) wrote in message news:<b60f5e04. 0307281559.749a 03d3@posting.go ogle.com>...[color=blue]
    > Hi,
    >
    > I have a weird problem using openssl_get_pri vatekey. I use this
    > function to decrypt some records from a database. The first two get
    > decrypted fine, but at the third function call, openssl_get_pri vatekey
    > returns false and the script stops outputting, with this error string:
    >
    > error:0407106B: rsa routines:RSA_pa dding_check_PKC S1_type_2:block type
    > is not 02
    >
    > I use PHP 4.2.3 with openssl 0.9.6e
    >
    > Any ideas?
    >
    > Alex[/color]

    Comment

    Working...