The sizes that a symmetric cryptographic key can take.


struct SymmetricKeySize


When creating a new SymmetricKey instance with a call to its init(size:) initializer, you typically use one of the standard key sizes, like bits128, bits192, or bits256. When you need a key with a non-standard length, use the init(bitCount:) initializer to create a SymmetricKeySize instance with a custom bit count.


Using Standard Key Lengths

Creating a Nonstandard Key Length

init(bitCount: Int)

Creates a new key size of the given length.

Getting the Length

let bitCount: Int

The number of bits in the key.

See Also

Creating a Key

init<D>(data: D)

Creates a key from the given data.

init(size: SymmetricKeySize)

Generates a new random key of the given size.