HumHub Documentation (unofficial)

JWSVerifier
in package

Table of Contents

Properties

$signatureAlgorithmManager  : AlgorithmManager

Methods

__construct()  : mixed
JWSVerifier constructor.
getSignatureAlgorithmManager()  : AlgorithmManager
Returns the algorithm manager associated to the JWSVerifier.
verifyWithKey()  : bool
This method will try to verify the JWS object using the given key and for the given signature.
verifyWithKeySet()  : bool
This method will try to verify the JWS object using the given key set and for the given signature.
checkPayload()  : void
getAlgorithm()  : MacAlgorithm|SignatureAlgorithm
getInputToVerify()  : string
isPayloadEmpty()  : bool
verifySignature()  : bool

Properties

Methods

verifyWithKey()

This method will try to verify the JWS object using the given key and for the given signature.

public verifyWithKey(JWS $jws, JWK $jwk, int $signature[, string|null $detachedPayload = null ]) : bool

It returns true if the signature is verified, otherwise false.

Parameters
$jws : JWS
$jwk : JWK
$signature : int
$detachedPayload : string|null = null
Return values
bool

true if the verification of the signature succeeded, else false

verifyWithKeySet()

This method will try to verify the JWS object using the given key set and for the given signature.

public verifyWithKeySet(JWS $jws, JWKSet $jwkset, int $signatureIndex[, null|string $detachedPayload = null ][, JWK &$jwk = null ]) : bool

It returns true if the signature is verified, otherwise false.

Parameters
$jws : JWS

A JWS object

$jwkset : JWKSet

The signature will be verified using keys in the key set

$signatureIndex : int
$detachedPayload : null|string = null

If not null, the value must be the detached payload encoded in Base64 URL safe. If the input contains a payload, throws an exception.

$jwk : JWK = null

The key used to verify the signature in case of success

Tags
throws
InvalidArgumentException

if there is no key in the keyset

throws
InvalidArgumentException

if the token does not contain any signature

Return values
bool

true if the verification of the signature succeeded, else false

checkPayload()

private checkPayload(JWS $jws[, string|null $detachedPayload = null ]) : void
Parameters
$jws : JWS
$detachedPayload : string|null = null
Tags
throws
InvalidArgumentException

if the payload is set when a detached payload is provided or no payload is defined

getInputToVerify()

private getInputToVerify(JWS $jws, Signature $signature, string|null $detachedPayload) : string
Parameters
$jws : JWS
$signature : Signature
$detachedPayload : string|null
Return values
string

isPayloadEmpty()

private isPayloadEmpty(string|null $payload) : bool
Parameters
$payload : string|null
Return values
bool

verifySignature()

private verifySignature(JWS $jws, JWKSet $jwkset, Signature $signature[, string|null $detachedPayload = null ][, JWK &$successJwk = null ]) : bool
Parameters
$jws : JWS
$jwkset : JWKSet
$signature : Signature
$detachedPayload : string|null = null
$successJwk : JWK = null
Return values
bool

        
On this page

Search results