#import <Foundation/Foundation.h>
#define CKKSKeySize (512/8)
#define CKKSWrappedKeySize (CKKSKeySize+16)
@interface CKKSBaseAESSIVKey : NSObject <NSCopying> {
@package
uint8_t key[CKKSWrappedKeySize]; size_t size;
}
- (instancetype)init;
- (instancetype)initWithBytes:(uint8_t *)bytes len:(size_t)len;
- (void)zeroKey;
- (instancetype)copyWithZone:(NSZone *)zone;
- (instancetype)initWithBase64: (NSString*) base64bytes;
- (BOOL)isEqual: (id) object;
@end
@interface CKKSWrappedAESSIVKey : CKKSBaseAESSIVKey
- (instancetype)initWithData: (NSData*) data;
- (NSData*)wrappedData;
- (NSString*) base64WrappedKey;
@end
@interface CKKSAESSIVKey : CKKSBaseAESSIVKey
+ (instancetype)randomKey;
- (CKKSWrappedAESSIVKey*)wrapAESKey: (CKKSAESSIVKey*) keyToWrap error: (NSError * __autoreleasing *) error;
- (CKKSAESSIVKey*)unwrapAESKey: (CKKSWrappedAESSIVKey*) keyToUnwrap error: (NSError * __autoreleasing *) error;
- (NSData*)encryptData: (NSData*) plaintext authenticatedData: (NSDictionary<NSString*, NSData*>*) ad error: (NSError * __autoreleasing *) error;
- (NSData*)decryptData: (NSData*) ciphertext authenticatedData: (NSDictionary<NSString*, NSData*>*) ad error: (NSError * __autoreleasing *) error;
@end