public static loadKeyFromCertificate ( string $certificate ) : array | ||
$certificate | string | |
return | array |
/** * @return \Jose\Object\JWKInterface[] */ public function getKeys() { $content = json_decode($this->getContent(), true); Assertion::isArray($content, 'Invalid content.'); $jwkset = new JWKSet(); foreach ($content as $kid => $cert) { $jwk = KeyConverter::loadKeyFromCertificate($cert); Assertion::notEmpty($jwk, 'Invalid content.'); if (is_string($kid)) { $jwk['kid'] = $kid; } $jwkset->addKey(new JWK($jwk)); } return $jwkset->getKeys(); }
/** * {@inheritdoc} */ public static function createFromCertificate($certificate, array $additional_values = []) { $values = KeyConverter::loadKeyFromCertificate($certificate); $values = array_merge($values, $additional_values); return new JWK($values); }
/** * @param string $x5u * @param bool $allow_unsecured_connection * * @return \Jose\Object\JWKSetInterface */ public static function createFromX5U($x5u, $allow_unsecured_connection = false) { $content = self::downloadContent($x5u, $allow_unsecured_connection); $content = json_decode($content, true); if (!is_array($content)) { throw new \InvalidArgumentException('Invalid content.'); } $jwkset = new JWKSet(); foreach ($content as $kid => $cert) { $jwk = KeyConverter::loadKeyFromCertificate($cert); if (empty($jwk)) { throw new \InvalidArgumentException('Invalid content.'); } if (is_string($kid)) { $jwk['kid'] = $kid; } $jwkset->addKey(new JWK($jwk)); } return $jwkset; }