]> git.saurik.com Git - apple/security.git/blob - KeychainCircle/KCAESGCMDuplexSession.h
Security-59754.41.1.tar.gz
[apple/security.git] / KeychainCircle / KCAESGCMDuplexSession.h
1 //
2 // KCAESGCMDuplexSession.h
3 // Security
4 //
5 //
6
7 #import <Foundation/Foundation.h>
8
9 NS_ASSUME_NONNULL_BEGIN
10
11 @interface KCAESGCMDuplexSession : NSObject <NSSecureCoding>
12
13 // Due to design constraints, this session object is the only thing serialized during piggybacking sessions.
14 // Therefore, we must add some extra data here, which is not strictly part of a AES GCM session.
15 @property (retain, nullable) NSString* pairingUUID;
16 @property uint64_t piggybackingVersion;
17 @property uint64_t epoch;
18
19 - (nullable NSData*) encrypt: (NSData*) data error: (NSError**) error;
20 - (nullable NSData*) decryptAndVerify: (NSData*) data error: (NSError**) error;
21
22 + (nullable instancetype) sessionAsSender: (NSData*) sharedSecret
23 context: (uint64_t) context;
24 + (nullable instancetype) sessionAsReceiver: (NSData*) sharedSecret
25 context: (uint64_t) context;
26
27 - (nullable instancetype) initAsSender: (NSData*) sharedSecret
28 context: (uint64_t) context;
29 - (nullable instancetype) initAsReceiver: (NSData*) sharedSecret
30 context: (uint64_t) context;
31 - (nullable instancetype) initWithSecret: (NSData*) sharedSecret
32 context: (uint64_t) context
33 as: (bool) inverted;
34
35 - (nullable instancetype)initWithSecret:(NSData*)sharedSecret
36 context:(uint64_t)context
37 as:(bool) sender
38 pairingUUID:(NSString* _Nullable)pairingUUID
39 piggybackingVersion:(uint64_t)piggybackingVersion
40 epoch:(uint64_t)epoch
41 NS_DESIGNATED_INITIALIZER;
42
43 - (instancetype) init NS_UNAVAILABLE;
44
45
46 - (void)encodeWithCoder:(NSCoder *)aCoder;
47 - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder;
48 + (BOOL)supportsSecureCoding;
49
50 @end
51
52 NS_ASSUME_NONNULL_END