getEncodedProtectedHeaders() public méthode

The protected header associated with the signature.
public getEncodedProtectedHeaders ( ) : null | string
Résultat null | string
Exemple #1
0
 /**
  * @param \Jose\Object\JWSInterface       $jws
  * @param \Jose\Object\SignatureInterface $signature
  * @param string|null                     $detached_payload
  *
  * @return string
  */
 private function getInputToVerify(Object\JWSInterface $jws, Object\SignatureInterface $signature, $detached_payload)
 {
     $encoded_protected_headers = $signature->getEncodedProtectedHeaders();
     if (!$signature->hasProtectedHeader('b64') || true === $signature->getProtectedHeader('b64')) {
         if (null !== $jws->getEncodedPayload($signature)) {
             return sprintf('%s.%s', $encoded_protected_headers, $jws->getEncodedPayload($signature));
         }
         $payload = empty($jws->getPayload()) ? $detached_payload : $jws->getPayload();
         $payload = is_string($payload) ? $payload : json_encode($payload);
         return sprintf('%s.%s', $encoded_protected_headers, Base64Url::encode($payload));
     }
     $payload = empty($jws->getPayload()) ? $detached_payload : $jws->getPayload();
     $payload = is_string($payload) ? $payload : json_encode($payload);
     return sprintf('%s.%s', $encoded_protected_headers, $payload);
 }