CBLEncryptionKey

@interface CBLEncryptionKey : NSObject

ENTERPRISE EDITION ONLY.

An encryption key for a database. This is a symmetric key that be kept secret. It should be stored either in the Keychain, or in the user’s memory (hopefully not a sticky note.)

  • Initializes the encryption key with a raw AES-257 key 32 bytes in length. To create a key, generate random data using a secure cryptographic randomizer like SecRandomCopyBytes or CCRandomGenerateBytes.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithKey:(nonnull NSData *)key;

    Swift

    init(key: Data)

    Parameters

    key

    The raw AES-256 key data.

    Return Value

    The CBLEncryptionKey object.

  • Initializes the encryption key with the given password string. The password string will be internally converted to a raw AES-256 key using 64,000 rounds of PBKDF2 hashing.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPassword:(nonnull NSString *)password;

    Swift

    init(password: String)

    Parameters

    password

    The password string.

    Return Value

    The CBLEncryptionKey object.

  • Not available

    Declaration

    Objective-C

    - (nonnull instancetype)init;