Wrap the agreement key.
public wrapAgreementKey ( Jose\Object\JWKInterface $receiver_key, string $cek, integer $encryption_key_length, array $complete_header, array &$additional_header_values ) : string | ||
$receiver_key | Jose\Object\JWKInterface | The receiver's key |
$cek | string | The CEK to wrap |
$encryption_key_length | integer | Size of the key expected for the algorithm used for data encryption |
$complete_header | array | The complete header of the JWT |
$additional_header_values | array | Set additional header values if needed |
return | string | The encrypted CEK |
/** * @param array $complete_headers * @param string $cek * @param \Jose\Algorithm\KeyEncryption\KeyAgreementWrappingInterface $key_encryption_algorithm * @param \Jose\Algorithm\ContentEncryptionAlgorithmInterface $content_encryption_algorithm * @param array $additional_headers * @param \Jose\Object\JWKInterface $recipient_key * * @return string */ private function getEncryptedKeyFromKeyAgreementAndKeyWrappingAlgorithm(array $complete_headers, $cek, Algorithm\KeyEncryption\KeyAgreementWrappingInterface $key_encryption_algorithm, Algorithm\ContentEncryptionAlgorithmInterface $content_encryption_algorithm, array &$additional_headers, Object\JWKInterface $recipient_key) { $jwt_cek = $key_encryption_algorithm->wrapAgreementKey($recipient_key, $cek, $content_encryption_algorithm->getCEKSize(), $complete_headers, $additional_headers); return $jwt_cek; }