Jose\Decrypter::decryptCEK PHP Метод

decryptCEK() приватный Метод

private decryptCEK ( Jose\Algorithm\JWAInterface $key_encryption_algorithm, Jose\Algorithm\ContentEncryptionAlgorithmInterface $content_encryption_algorithm, Jose\Object\JWKInterface $key, Jose\Object\RecipientInterface $recipient, array $complete_headers ) : null | string
$key_encryption_algorithm Jose\Algorithm\JWAInterface
$content_encryption_algorithm Jose\Algorithm\ContentEncryptionAlgorithmInterface
$key Jose\Object\JWKInterface
$recipient Jose\Object\RecipientInterface
$complete_headers array
Результат null | string
    private function decryptCEK(Algorithm\JWAInterface $key_encryption_algorithm, Algorithm\ContentEncryptionAlgorithmInterface $content_encryption_algorithm, Object\JWKInterface $key, Object\RecipientInterface $recipient, array $complete_headers)
    {
        if ($key_encryption_algorithm instanceof Algorithm\KeyEncryption\DirectEncryptionInterface) {
            return $key_encryption_algorithm->getCEK($key);
        } elseif ($key_encryption_algorithm instanceof Algorithm\KeyEncryption\KeyAgreementInterface) {
            return $key_encryption_algorithm->getAgreementKey($content_encryption_algorithm->getCEKSize(), $content_encryption_algorithm->getAlgorithmName(), $key, $complete_headers);
        } elseif ($key_encryption_algorithm instanceof Algorithm\KeyEncryption\KeyAgreementWrappingInterface) {
            return $key_encryption_algorithm->unwrapAgreementKey($key, $recipient->getEncryptedKey(), $content_encryption_algorithm->getCEKSize(), $complete_headers);
        } elseif ($key_encryption_algorithm instanceof Algorithm\KeyEncryption\KeyEncryptionInterface) {
            return $key_encryption_algorithm->decryptKey($key, $recipient->getEncryptedKey(), $complete_headers);
        } elseif ($key_encryption_algorithm instanceof Algorithm\KeyEncryption\KeyWrappingInterface) {
            return $key_encryption_algorithm->unwrapKey($key, $recipient->getEncryptedKey(), $complete_headers);
        } else {
            throw new \InvalidArgumentException('Unsupported CEK generation');
        }
    }