/** * Returns the key size * * More specifically, this returns the size of the modulo in bits. * * @access public * @return Integer */ function getSize() { return !isset($this->modulus) ? 0 : strlen($this->modulus->toBits()); }
/** * RSASSA-PSS-VERIFY * * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.2 RFC3447#section-8.1.2}. * * @access private * @param String $m * @param String $s * @return String */ function _rsassa_pss_verify($m, $s) { // Length checking if (strlen($s) > $this->k) { user_error('Invalid signature', E_USER_NOTICE); return false; } // add leading zeros if missing added by Pfeffer while (strlen($s) < $this->k) { $s = chr(0) . $s; } // RSA verification $tmp = $this->modulus->toBits(); $modBits = strlen($tmp); // by Pfeffer, has been: 8 * $this->k; $s2 = $this->_os2ip($s); $m2 = $this->_rsavp1($s2); if ($m2 === false) { user_error('Invalid signature', E_USER_NOTICE); return false; } $tmp = $modBits / 8; // by pfeffer, has been: $modBits >> 3 $em = $this->_i2osp($m2, ceil($tmp)); if ($em === false) { user_error('Invalid signature', E_USER_NOTICE); return false; } // EMSA-PSS verification return $this->_emsa_pss_verify($m, $em, $modBits - 1); }