getRecipients() public method

Returns the recipients associated with the JWS.
public getRecipients ( ) : Jose\Object\RecipientInterface[]
return Jose\Object\RecipientInterface[]
コード例 #1
0
ファイル: EncrypterTrait.php プロジェクト: spomky-labs/jose
 /**
  * @param \Jose\Object\JWEInterface $jwe
  *
  * @return \Jose\Algorithm\ContentEncryptionAlgorithmInterface
  */
 private function getContentEncryptionAlgorithm(Object\JWEInterface $jwe)
 {
     $algorithm = null;
     foreach ($jwe->getRecipients() as $recipient) {
         $complete_headers = array_merge($jwe->getSharedProtectedHeaders(), $jwe->getSharedHeaders(), $recipient->getHeaders());
         Assertion::keyExists($complete_headers, 'enc', 'Parameter "enc" is missing.');
         if (null === $algorithm) {
             $algorithm = $complete_headers['enc'];
         } else {
             Assertion::eq($algorithm, $complete_headers['enc'], 'Foreign content encryption algorithms are not allowed.');
         }
     }
     $content_encryption_algorithm = $this->getJWAManager()->getAlgorithm($algorithm);
     Assertion::isInstanceOf($content_encryption_algorithm, Algorithm\ContentEncryptionAlgorithmInterface::class, sprintf('The content encryption algorithm "%s" is not supported or not a content encryption algorithm instance.', $algorithm));
     return $content_encryption_algorithm;
 }