/** * {@inheritdoc} */ public function sign(Object\JWSInterface &$jws) { $nb_signatures = $jws->countSignatures(); for ($i = 0; $i < $nb_signatures; $i++) { $this->computeSignature($jws, $jws->getSignature($i)); } }
/** * {@inheritdoc} */ public function checkJWS(Object\JWSInterface $jws, $signature) { Assertion::integer($signature); Assertion::lessThan($signature, $jws->countSignatures()); $checked_claims = $this->checkJWT($jws); $protected_headers = $jws->getSignature($signature)->getProtectedHeaders(); $headers = $jws->getSignature($signature)->getHeaders(); $this->checkHeaders($protected_headers, $headers, $checked_claims); }
/** * @param \Jose\Object\JWSInterface $jws */ private function checkSignatures(Object\JWSInterface $jws) { Assertion::greaterThan($jws->countSignatures(), 0, 'The JWS does not contain any signature.'); }