Jwk
extends
JsonSerializable
in
Represents a JSON Web Key.
Table of Contents
Methods
- getAlgorithm() : string|null
- Gets the algorithm of this key, equivalent to the "alg" field.
- getId() : string|null
- Gets the ID of this key, equivalent to the "kid" field.
- getPublicKey() : Jwk|null
- Gets an instance of Jwk that ensures it is backed by a public key.
- sign() : string
- Signs data using this key. Only available if it is backed by a private key.
- verify() : bool
- Verifies data against this key.
Methods
getAlgorithm()
Gets the algorithm of this key, equivalent to the "alg" field.
public
getAlgorithm() : string|null
Return values
string|nullgetId()
Gets the ID of this key, equivalent to the "kid" field.
public
getId() : string|null
Return values
string|nullgetPublicKey()
Gets an instance of Jwk that ensures it is backed by a public key.
public
getPublicKey() : Jwk|null
Will return null if it is impossible to create a public representation of this key.
Return values
Jwk|nullsign()
Signs data using this key. Only available if it is backed by a private key.
public
sign(string $data[, string|null $algo = null ]) : string
Parameters
- $data : string
-
Data to be signed.
- $algo : string|null = null
-
JWK algorithm to sign the data with.
Tags
Return values
stringverify()
Verifies data against this key.
public
verify(string $data, string $signature[, string|null $algo = null ]) : bool
Parameters
- $data : string
-
Data to be verified.
- $signature : string
-
Signature of the data.
- $algo : string|null = null
-
JWK algorithm to verify the data with.