function _rsaes_oaep_decrypt($c, $l = '')
    {
        // Length checking

        // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error
        // be output.

        if (strlen($c) != $this->k || $this->k < 2 * $this->hLen + 2) {
            user_error('Decryption error');
            return false;
        }

        // RSA decryption

        $c = $this->_os2ip($c);
        $m = $this->_rsadp($c);
        if ($m === false) {
            user_error('Decryption error');
            return false;
        }
        $em = $this->_i2osp($m, $this->k);

        // EME-OAEP decoding

        $lHash = $this->hash->hash($l);
        $y = ord($em[0]);
        $maskedSeed = substr($em, 1, $this->hLen);
        $maskedDB = substr($em, $this->hLen + 1);
        $seedMask = $this->_mgf1($maskedDB, $this->hLen);
        $seed = $maskedSeed ^ $seedMask;
        $dbMask = $this->_mgf1($seed, $this->k - $this->hLen - 1);
        $db = $maskedDB ^ $dbMask;
        $lHash2 = substr($db, 0, $this->hLen);
        $m = substr($db, $this->hLen);
        if (!$this->_equals($lHash, $lHash2)) {
            user_error('Decryption error');
            return false;
        }
        $m = ltrim($m, chr(0));
        if (ord($m[0]) != 1) {
            user_error('Decryption error');
            return false;
        }

        // Output the message M

        return substr($m, 1);
    }
function _rsaes_oaep_decrypt($c, $l = '')
    {
        // Length checking

        // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error
        // be output.

        if (strlen($c) != $this->k || $this->k < 2 * $this->hLen + 2) {
            user_error('Decryption error');
            return false;
        }

        // RSA decryption

        $c = $this->_os2ip($c);
        $m = $this->_rsadp($c);
        if ($m === false) {
            user_error('Decryption error');
            return false;
        }
        $em = $this->_i2osp($m, $this->k);

        // EME-OAEP decoding

        $lHash = $this->hash->hash($l);
        $y = ord($em[0]);
        $maskedSeed = substr($em, 1, $this->hLen);
        $maskedDB = substr($em, $this->hLen + 1);
        $seedMask = $this->_mgf1($maskedDB, $this->hLen);
        $seed = $maskedSeed ^ $seedMask;
        $dbMask = $this->_mgf1($seed, $this->k - $this->hLen - 1);
        $db = $maskedDB ^ $dbMask;
        $lHash2 = substr($db, 0, $this->hLen);
        $m = substr($db, $this->hLen);
        if (!$this->_equals($lHash, $lHash2)) {
            user_error('Decryption error');
            return false;
        }
        $m = ltrim($m, chr(0));
        if (ord($m[0]) != 1) {
            user_error('Decryption error');
            return false;
        }

        // Output the message M

        return substr($m, 1);
    }
function _rsaes_oaep_decrypt ( $ c , $ l = '' ) { // Length checking // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error // be output. if ( strlen ( $ c ) != $ this -> k || $ this -> k < 2 * $ this -> hLen + 2 ) { user_error ( 'Decryption error' ) ; return false ; } // RSA decryption $ c = $ this -> _os2ip ( $ c ) ; $ m = $ this -> _rsadp ( $ c ) ; if ( $ m === false ) { user_error ( 'Decryption error' ) ; return false ; } $ em = $ this -> _i2osp ( $ m , $ this -> k ) ; // EME-OAEP decoding $ lHash = $ this -> hash -> hash ( $ l ) ; $ y = ord ( $ em [ 0 ] ) ; $ maskedSeed = substr ( $ em , 1 , $ this -> hLen ) ; $ maskedDB = substr ( $ em , $ this -> hLen + 1 ) ; $ seedMask = $ this -> _mgf1 ( $ maskedDB , $ this -> hLen ) ; $ seed = $ maskedSeed ^ $ seedMask ; $ dbMask = $ this -> _mgf1 ( $ seed , $ this -> k - $ this -> hLen - 1 ) ; $ db = $ maskedDB ^ $ dbMask ; $ lHash2 = substr ( $ db , 0 , $ this -> hLen ) ; $ m = substr ( $ db , $ this -> hLen ) ; if ( ! $ this -> _equals ( $ lHash , $ lHash2 ) ) { user_error ( 'Decryption error' ) ; return false ; } $ m = ltrim ( $ m , chr ( 0 ) ) ; if ( ord ( $ m [ 0 ] ) != 1 ) { user_error ( 'Decryption error' ) ; return false ; } // Output the message M return substr ( $ m , 1 ) ; }
RSAES-OAEP-DECRYPT

See {@link http://tools.ietf.org/html/rfc3447#section-7.1.2 RFC3447#section-7.1.2}.  The fact that the error
messages aren't distinguishable from one another hinders debugging, but, to quote from RFC3447#section-7.1.2:

Note.  Care must be taken to ensure that an opponent cannot
distinguish the different error conditions in Step 3.g, whether by
error message or timing, or, more generally, learn partial
information about the encoded message EM.  Otherwise an opponent may
be able to obtain useful information about the decryption of the
ciphertext C, leading to a chosen-ciphertext attack such as the one
observed by Manger [36].

As for $l...  to quote from {@link http://tools.ietf.org/html/rfc3447#page-17 RFC3447#page-17}:

Both the encryption and the decryption operations of RSAES-OAEP take
the value of a label L as input.  In this version of PKCS #1, L is
the empty string; other uses of the label are outside the scope of
this document.

@access private
@param string $c
@param string $l
@return string
RSAES - OAEP - DECRYPT