KeyWrap

public enum KeyWrap

The Key Wrapping module provides AES Key Wrapping, according to the IETF RFC 3394 specification.

  • Wraps a key with AES wrap (RFC 3394), according to the IETF RFC 3394 specification.

    Declaration

    Swift

    public static func wrap(_ keyToWrap: SymmetricKey, using kek: SymmetricKey) throws -> Data

    Parameters

    keyToWrap

    The key to wrap

    kek

    The Key Encryption Key

    Return Value

    The wrapped key

  • Unwraps a key with AES wrap, according to the IETF RFC 3394 specification.

    Declaration

    Swift

    public static func unwrap<WrappedKey>(_ wrappedKey: WrappedKey, using kek: SymmetricKey) throws -> SymmetricKey where WrappedKey : DataProtocol

    Parameters

    wrappedKey

    The wrapped key

    kek

    The key encryption key

    Return Value

    The unwrapped key, the method will throw if the payload was incorrectly wrapped.