Learn R Programming

openssl (version 2.6.0)

aes_keywrap: AES key wrap

Description

Encrypt a key with another key (the key-encryption key) using the AES key wrap algorithm from RFC 3394. This is used for example by JWE (A128KW, A256KW). Unwrapping verifies the integrity of the wrapped key.

Usage

aes_keywrap(data, key)

aes_keyunwrap(data, key)

Arguments

data

raw vector with the key to wrap (a multiple of 8 bytes, at least 16) or the wrapped key to unwrap

key

raw vector of length 16, 24 or 32 with the key-encryption key

Examples

Run this code
kek <- rand_bytes(32)
cek <- rand_bytes(32)
wrapped <- aes_keywrap(cek, kek)
stopifnot(identical(aes_keyunwrap(wrapped, kek), cek))

Run the code above in your browser using DataLab