/** * @see AbstractKeyInstance::deserializeFromObject($obj) */ protected function deserializeFromObject($obj) { $this->key_p = new MathBigInteger($obj["p"], 16); $this->key_q = new MathBigInteger($obj["q"], 16); $this->key_g = new MathBigInteger($obj["g"], 16); $this->key_x = new MathBigInteger($obj["x"], 16); $this->keysize = DSAKeyPair::_getKeySizeFromRSAKeySize(strlen($this->key_p->toBits())); return $this; }
/** * @see AbstractKeyInstance::deserializeFromObject($obj) */ protected function deserializeFromObject($obj) { $this->key_p = new MathBigInteger($obj["p"], 16); $this->key_q = new MathBigInteger($obj["q"], 16); $this->key_g = new MathBigInteger($obj["g"], 16); $this->key_y = new MathBigInteger($obj["y"], 16); $this->keysize = DSAKeyPair::_getKeySizeFromRSAKeySize(strlen($this->key_y->toBits())); $this->key_values = DSAKeyPair::$KEYSIZES[$this->keysize]; return $this; }
/** * @see AbstractKeyInstance::deserializeFromObject($obj) */ protected function deserializeFromObject($obj) { $n = new MathBigInteger($obj["n"]); $e = new MathBigInteger($obj["e"]); $array = array("n" => $n, "e" => $e); $this->rsa->loadKey($array, CRYPT_RSA_PUBLIC_FORMAT_RAW); $this->rsa->setPublicKey($array, CRYPT_RSA_PUBLIC_FORMAT_RAW); $this->keysize = RSAKeyPair::_getKeySizeFromRSAKeySize(strlen($n->toBits())); $this->rsa->setHash(RSAKeyPair::$KEYSIZES[$this->keysize]["hashAlg"]); return $this; }
/** * 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()); }