JSON Web Key implementation, based on this spec:
https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41

PHP version 5

CloneableInstantiable
Methods
public static parseKeySet(array $jwks)
 

Parse a set of JWK keys

  • return array An associative array that represents the set of keys
  • throws InvalidArgumentException Provided JWK Set is empty
  • throws UnexpectedValueException Provided JWK Set was invalid
  • throws DomainException OpenSSL failure
  • uses \parseKey
Methods
private static createPemFromModulusAndExponent( $n, $e)
 

Create a public key represented in PEM format from RSA modulus and exponent information

  • return string The RSA public key represented in PEM format
  • uses \encodeLength
private static encodeLength( $length)
 

DER-encode the length

DER supports lengths up to (28)127, however, we'll only support lengths up to (28)4. See
{@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.

  • return string
private static parseKey(array $jwk)
 

Parse a JWK key

  • return resource|array An associative array that represents the key
  • throws InvalidArgumentException Provided JWK is empty
  • throws UnexpectedValueException Provided JWK was invalid
  • throws DomainException OpenSSL failure
  • uses \createPemFromModulusAndExponent
Methods
private static createPemFromModulusAndExponent( $n, $e)
 

Create a public key represented in PEM format from RSA modulus and exponent information

  • return string The RSA public key represented in PEM format
  • uses \encodeLength
private static encodeLength( $length)
 

DER-encode the length

DER supports lengths up to (28)127, however, we'll only support lengths up to (28)4. See
{@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.

  • return string
private static parseKey(array $jwk)
 

Parse a JWK key

  • return resource|array An associative array that represents the key
  • throws InvalidArgumentException Provided JWK is empty
  • throws UnexpectedValueException Provided JWK was invalid
  • throws DomainException OpenSSL failure
  • uses \createPemFromModulusAndExponent
public static parseKeySet(array $jwks)
 

Parse a set of JWK keys

  • return array An associative array that represents the set of keys
  • throws InvalidArgumentException Provided JWK Set is empty
  • throws UnexpectedValueException Provided JWK Set was invalid
  • throws DomainException OpenSSL failure
  • uses \parseKey
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only