#if OCTAGON
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
#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* _Nullable)zone;
- (instancetype)initWithBase64:(NSString*)base64bytes;
- (BOOL)isEqual:(id _Nullable)object;
@end
@interface CKKSWrappedAESSIVKey : CKKSBaseAESSIVKey <NSSecureCoding>
- (instancetype)initWithData:(NSData*)data;
- (NSData*)wrappedData;
- (NSString*)base64WrappedKey;
+ (CKKSWrappedAESSIVKey*)zeroedKey;
@end
@interface CKKSAESSIVKey : CKKSBaseAESSIVKey
+ (instancetype _Nullable)randomKey:(NSError*__autoreleasing*)error;
- (CKKSWrappedAESSIVKey* _Nullable)wrapAESKey:(CKKSAESSIVKey*)keyToWrap
error:(NSError* __autoreleasing*)error;
- (CKKSAESSIVKey* _Nullable)unwrapAESKey:(CKKSWrappedAESSIVKey*)keyToUnwrap
error:(NSError* __autoreleasing*)error;
- (NSData* _Nullable)encryptData:(NSData*)plaintext
authenticatedData:(NSDictionary<NSString*, NSData*>* _Nullable)ad
error:(NSError* __autoreleasing*)error;
- (NSData* _Nullable)decryptData:(NSData*)ciphertext
authenticatedData:(NSDictionary<NSString*, NSData*>* _Nullable)ad
error:(NSError* __autoreleasing*)error;
- (NSData*)keyMaterial;
@end
NS_ASSUME_NONNULL_END
#endif // OCTAGON