7 #import <Foundation/Foundation.h>
9 #include <corecrypto/ccdigest.h>
10 #include <corecrypto/ccrng.h>
11 #include <corecrypto/ccsrp.h>
13 NS_ASSUME_NONNULL_BEGIN
15 @interface KCSRPContext
: NSObject
17 - (instancetype
) init NS_UNAVAILABLE
;
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
;
24 - (bool) isAuthenticated
;
26 // Returns an NSData that refers to the key in the context.
27 // It becomes invalid when this context is released.
32 @interface KCSRPClientContext
: KCSRPContext
34 - (nullable NSData
*) copyStart
: (NSError
**) error
;
35 - (nullable NSData
*) copyResposeToChallenge
: (NSData
*) B_data
36 password
: (NSString
*) password
38 error
: (NSError
**) error
;
39 - (bool) verifyConfirmation
: (NSData
*) HAMK_data
40 error
: (NSError
**) error
;
44 @interface KCSRPServerContext
: KCSRPContext
45 @
property (readonly
) NSData
* salt
;
47 - (instancetype
) initWithUser
: (NSString
*) user
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
;
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
;
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
;
66 - (bool) resetWithPassword
: (NSString
*) password
67 error
: (NSError
**) error
;
69 - (nullable NSData
*) copyChallengeFor
: (NSData
*) A_data
70 error
: (NSError
**) error
;
71 - (nullable NSData
*) copyConfirmationFor
: (NSData
*) M_data
72 error
: (NSError
**) error
;