/** * @param PublicKey $public_key * @return IAsymmetricJWK * @throws InvalidJWKType */ public static function fromPublicKey(PublicKey $public_key) { if (!$public_key instanceof RSAPublicKey) { throw new InvalidJWKType(); } $jwk = new RSAJWK(); $jwk->public_key = $public_key; $jwk->set[RSAKeysParameters::Exponent] = Base64urlUInt::fromBigInt($public_key->getPublicExponent()); $jwk->set[RSAKeysParameters::Modulus] = Base64urlUInt::fromBigInt($public_key->getModulus()); return $jwk; }
/** * @return bool */ protected function checkX509CertMismatch() { $x509 = $this->getX509LeafCertificate(); return !is_null($x509) && $x509->getPublicKey() !== $this->public_key->getEncoded(); }