static func wrap(_ keyToWrap: SymmetricKey, using kek: SymmetricKey) throws -> Data
Wraps a key using the AES wrap algorithm.
Wrap is an implementation of the AES key wrap algorithm as specified
in IETF RFC 3394.
- Parameters:
- keyToWrap: The key to wrap.
- kek: The key encryption key.
- Returns: The wrapped key.
static func unwrap<WrappedKey>(_ wrappedKey: WrappedKey, using kek: SymmetricKey) throws -> SymmetricKey where WrappedKey : DataProtocol
Unwraps a key using the AES wrap algorithm.
Wrap is an implementation of the AES key wrap algorithm as specified
in IETF RFC 3394. The method throws an error is the key was
incorrectly wrapped.
- Parameters:
- wrappedKey: The key to unwrap.
- kek: The key encryption key.
- Returns: The unwrapped key.