Exemple #1
0
 /**
 * Defines the private key
 *
 * @see setPrivateKey()
 * @access public
 * @param String $key
 * @param Integer $type optional
 * @return Boolean
 */
 function setPrivateKey($key, $type = CRYPT_RSA_PUBLIC_FORMAT_PKCS1)
 {
     $components = $this->_parseKey($key, $type);
     if (empty($this->modulus) || !$this->modulus->equals($components['modulus'])) {
         user_error('Trying to load a public key?  Use loadKey() instead.  It\'s called loadKey() and not loadPrivateKey() for a reason.', E_USER_NOTICE);
         return false;
     }
     $this->exponent = $components['privateExponent'];
     $this->publicExponent = $components['publicExponent'];
     return true;
 }