]> git.saurik.com Git - apple/security.git/blob - KeychainCircle/KCSRPContext.h
Security-58286.270.3.0.1.tar.gz
[apple/security.git] / KeychainCircle / KCSRPContext.h
1 //
2 // SRPSession.h
3 // KeychainCircle
4 //
5 //
6
7 #import <Foundation/Foundation.h>
8
9 #include <corecrypto/ccdigest.h>
10 #include <corecrypto/ccrng.h>
11 #include <corecrypto/ccsrp.h>
12
13 NS_ASSUME_NONNULL_BEGIN
14
15 @interface KCSRPContext : NSObject
16
17 - (instancetype) init NS_UNAVAILABLE;
18
19 - (instancetype) initWithUser: (NSString*) user
20 digestInfo: (const struct ccdigest_info *) di
21 group: (ccsrp_const_gp_t) gp
22 randomSource: (struct ccrng_state *) rng NS_DESIGNATED_INITIALIZER;
23
24 - (bool) isAuthenticated;
25
26 // Returns an NSData that refers to the key in the context.
27 // It becomes invalid when this context is released.
28 - (NSData*) getKey;
29
30 @end
31
32 @interface KCSRPClientContext : KCSRPContext
33
34 - (nullable NSData*) copyStart: (NSError**) error;
35 - (nullable NSData*) copyResposeToChallenge: (NSData*) B_data
36 password: (NSString*) password
37 salt: (NSData*) salt
38 error: (NSError**) error;
39 - (bool) verifyConfirmation: (NSData*) HAMK_data
40 error: (NSError**) error;
41
42 @end
43
44 @interface KCSRPServerContext : KCSRPContext
45 @property (readonly) NSData* salt;
46
47 - (instancetype) initWithUser: (NSString*) user
48 salt: (NSData*) salt
49 verifier: (NSData*) verifier
50 digestInfo: (const struct ccdigest_info *) di
51 group: (ccsrp_const_gp_t) gp
52 randomSource: (struct ccrng_state *) rng NS_DESIGNATED_INITIALIZER;
53
54 - (instancetype) initWithUser: (NSString*)user
55 password: (NSString*)password
56 digestInfo: (const struct ccdigest_info *) di
57 group: (ccsrp_const_gp_t) gp
58 randomSource: (struct ccrng_state *) rng NS_DESIGNATED_INITIALIZER;
59
60 - (instancetype) initWithUser: (NSString*) user
61 digestInfo: (const struct ccdigest_info *) di
62 group: (ccsrp_const_gp_t) gp
63 randomSource: (struct ccrng_state *) rng NS_UNAVAILABLE;
64
65
66 - (bool) resetWithPassword: (NSString*) password
67 error: (NSError**) error;
68
69 - (nullable NSData*) copyChallengeFor: (NSData*) A_data
70 error: (NSError**) error;
71 - (nullable NSData*) copyConfirmationFor: (NSData*) M_data
72 error: (NSError**) error;
73
74 @end
75
76 NS_ASSUME_NONNULL_END