JWK
in package
JSON Web Key implementation, based on this spec: https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41
PHP version 5
Tags
Table of Contents
- parseKeySet() : array<string|int, mixed>
- Parse a set of JWK keys
- createPemFromModulusAndExponent() : string
- Create a public key represented in PEM format from RSA modulus and exponent information
- encodeLength() : string
- DER-encode the length
- parseKey() : resource|array<string|int, mixed>
- Parse a JWK key
Methods
parseKeySet()
Parse a set of JWK keys
public
static parseKeySet(array<string|int, mixed> $jwks) : array<string|int, mixed>
Parameters
- $jwks : array<string|int, mixed>
-
The JSON Web Key Set as an associative array
Tags
Return values
array<string|int, mixed> —An associative array that represents the set of keys
createPemFromModulusAndExponent()
Create a public key represented in PEM format from RSA modulus and exponent information
private
static createPemFromModulusAndExponent(string $n, string $e) : string
Parameters
- $n : string
-
The RSA modulus encoded in Base64
- $e : string
-
The RSA exponent encoded in Base64
Tags
Return values
string —The RSA public key represented in PEM format
encodeLength()
DER-encode the length
private
static encodeLength(int $length) : string
DER supports lengths up to (2**8)127, however, we'll only support lengths up to (28)**4. See X.690 paragraph 8.1.3 for more information.
Parameters
- $length : int
Return values
string —parseKey()
Parse a JWK key
private
static parseKey(array<string|int, mixed> $jwk) : resource|array<string|int, mixed>
Parameters
- $jwk : array<string|int, mixed>
-
An individual JWK
Tags
Return values
resource|array<string|int, mixed> —An associative array that represents the key