/** * @param string[] $selected_key_encryption_algorithms * @param string[] $selected_content_encryption_algorithms * @param string[] $selected_compression_methods * * @return \Jose\DecrypterInterface */ public function createDecrypter(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 Decrypter::createDecrypter($key_encryption_algorithms, $content_encryption_algorithms, $compression_methods); }
/** * @param string $input * @param \Jose\Object\JWKSetInterface $jwk_set * @param array $allowed_key_encryption_algorithms * @param array $allowed_content_encryption_algorithms * @param null|int $recipient_index * * @return \Jose\Object\JWEInterface */ private function loadAndDecrypt($input, Object\JWKSetInterface $jwk_set, array $allowed_key_encryption_algorithms, array $allowed_content_encryption_algorithms, &$recipient_index = null) { $jwt = $this->load($input); Assertion::isInstanceOf($jwt, Object\JWEInterface::class, 'The input is not a valid JWE'); $decrypted = Decrypter::createDecrypter($allowed_key_encryption_algorithms, $allowed_content_encryption_algorithms, ['DEF', 'ZLIB', 'GZ']); $decrypted->decryptUsingKeySet($jwt, $jwk_set, $recipient_index); return $jwt; }