function _rsaes_pkcs1_v1_5_encrypt($m)
    {
        $mLen = strlen($m);

        // Length checking

        if ($mLen > $this->k - 11) {
            user_error('Message too long');
            return false;
        }

        // EME-PKCS1-v1_5 encoding

        $psLen = $this->k - $mLen - 3;
        $ps = '';
        while (strlen($ps) != $psLen) {
            $temp = crypt_random_string($psLen - strlen($ps));
            $temp = str_replace("\x00", '', $temp);
            $ps.= $temp;
        }
        $type = 2;
        // see the comments of _rsaes_pkcs1_v1_5_decrypt() to understand why this is being done
        if (defined('CRYPT_RSA_PKCS15_COMPAT') && (!isset($this->publicExponent) || $this->exponent !== $this->publicExponent)) {
            $type = 1;
            // "The padding string PS shall consist of k-3-||D|| octets. ... for block type 01, they shall have value FF"
            $ps = str_repeat("\xFF", $psLen);
        }
        $em = chr(0) . chr($type) . $ps . chr(0) . $m;

        // RSA encryption
        $m = $this->_os2ip($em);
        $c = $this->_rsaep($m);
        $c = $this->_i2osp($c, $this->k);

        // Output the ciphertext C

        return $c;
    }
function _rsaes_pkcs1_v1_5_encrypt($m)
    {
        $mLen = strlen($m);

        // Length checking

        if ($mLen > $this->k - 11) {
            user_error('Message too long');
            return false;
        }

        // EME-PKCS1-v1_5 encoding

        $psLen = $this->k - $mLen - 3;
        $ps = '';
        while (strlen($ps) != $psLen) {
            $temp = crypt_random_string($psLen - strlen($ps));
            $temp = str_replace("\x00", '', $temp);
            $ps.= $temp;
        }
        $type = 2;
        // see the comments of _rsaes_pkcs1_v1_5_decrypt() to understand why this is being done
        if (defined('CRYPT_RSA_PKCS15_COMPAT') && (!isset($this->publicExponent) || $this->exponent !== $this->publicExponent)) {
            $type = 1;
            // "The padding string PS shall consist of k-3-||D|| octets. ... for block type 01, they shall have value FF"
            $ps = str_repeat("\xFF", $psLen);
        }
        $em = chr(0) . chr($type) . $ps . chr(0) . $m;

        // RSA encryption
        $m = $this->_os2ip($em);
        $c = $this->_rsaep($m);
        $c = $this->_i2osp($c, $this->k);

        // Output the ciphertext C

        return $c;
    }
function _rsaes_pkcs1_v1_5_encrypt ( $ m ) { $ mLen = strlen ( $ m ) ; // Length checking
 if ( $ mLen > $ this -> k - 11 ) { user_error ( 'Message too long' ) ; return false ; } // EME-PKCS1-v1_5 encoding
 $ psLen = $ this -> k - $ mLen - 3 ; $ ps = '' ; while ( strlen ( $ ps ) != $ psLen ) { $ temp = crypt_random_string ( $ psLen - strlen ( $ ps ) ) ; $ temp = str_replace ( "\x00" , '' , $ temp ) ; $ ps .= $ temp ; } $ type = 2 ; // see the comments of _rsaes_pkcs1_v1_5_decrypt() to understand why this is being done
 if ( defined ( 'CRYPT_RSA_PKCS15_COMPAT' ) && ( ! isset ( $ this -> publicExponent ) || $ this -> exponent !== $ this -> publicExponent ) ) { $ type = 1 ; // "The padding string PS shall consist of k-3-||D|| octets. ... for block type 01, they shall have value FF"
 $ ps = str_repeat ( "\xFF" , $ psLen ) ; } $ em = chr ( 0 ) . chr ( $ type ) . $ ps . chr ( 0 ) . $ m ; // RSA encryption
 $ m = $ this -> _os2ip ( $ em ) ; $ c = $ this -> _rsaep ( $ m ) ; $ c = $ this -> _i2osp ( $ c , $ this -> k ) ; // Output the ciphertext C
 return $ c ; }
RSAES-PKCS1-V1_5-ENCRYPT

See {@link http://tools.ietf.org/html/rfc3447#section-7.2.1 RFC3447#section-7.2.1}.

@access private
@param string $m
@return string
RSAES - PKCS1 - V1_5 - ENCRYPT