Inheritance: implements jose\EncrypterInterface, use trait Jose\Behaviour\HasKeyChecker, use trait Jose\Behaviour\HasJWAManager, use trait Jose\Behaviour\HasPayloadConverter, use trait Jose\Behaviour\HasCompressionManager
コード例 #1
0
 /**
  * @param string[] $selected_key_encryption_algorithms
  * @param string[] $selected_content_encryption_algorithms
  * @param string[] $selected_compression_methods
  *
  * @return \Jose\EncrypterInterface
  */
 public function createEncrypter(array $selected_key_encryption_algorithms, array $selected_content_encryption_algorithms, array $selected_compression_methods)
 {
     $key_encryption_algorithms = $this->algorithm_manager->getSelectedAlgorithmMethods($selected_key_encryption_algorithms);
     $content_encryption_algorithms = $this->algorithm_manager->getSelectedAlgorithmMethods($selected_content_encryption_algorithms);
     $compression_methods = $this->compression_manager->getSelectedCompressionMethods($selected_compression_methods);
     return Encrypter::createEncrypter($key_encryption_algorithms, $content_encryption_algorithms, $compression_methods);
 }
コード例 #2
0
ファイル: JWEFactory.php プロジェクト: spomky-labs/jose
 /**
  * @param mixed                     $payload
  * @param \Jose\Object\JWKInterface $recipient_key
  * @param array                     $shared_protected_headers
  * @param array                     $shared_headers
  * @param array                     $recipient_headers
  * @param string|null               $aad
  *
  * @return \Jose\Object\JWEInterface
  */
 private static function createJWEAndEncrypt($payload, JWKInterface $recipient_key, array $shared_protected_headers = [], $shared_headers = [], $recipient_headers = [], $aad = null)
 {
     $complete_headers = array_merge($shared_protected_headers, $shared_headers, $recipient_headers);
     Assertion::keyExists($complete_headers, 'alg', 'No "alg" parameter set in the header');
     Assertion::keyExists($complete_headers, 'enc', 'No "enc" parameter set in the header');
     $encrypter = Encrypter::createEncrypter([$complete_headers['alg']], [$complete_headers['enc']], ['DEF', 'ZLIB', 'GZ']);
     $jwe = self::createJWE($payload, $shared_protected_headers, $shared_headers, $aad);
     $jwe = $jwe->addRecipientInformation($recipient_key, $recipient_headers);
     $encrypter->encrypt($jwe);
     return $jwe;
 }