18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import <ObjFW/ObjFW.h>
#import "XMPPAuthenticator.h"
/**
* \brief A class to authenticate using SCRAM
*/
@interface XMPPSCRAMAuth: XMPPAuthenticator
{
Class hashType;
OFString *cNonce;
OFString *GS2Header;
OFString *clientFirstMessageBare;
OFDataArray *serverSignature;
}
/**
* Creates a new autoreleased XMPPSCRAMAuth with an authcid and password.
*
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param hash The class to use for calulating hashes
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password
hash: (Class)hash;
/**
* Creates a new autoreleased XMPPSCRAMAuth with an authzid,
* authcid and password.
*
* \param authzid The authzid to get authorization for
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param hash The class to use for calulating hashes
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
hash: (Class)hash;
/**
* Initializes an already allocated XMPPSCRAMAuth with an authcid and password.
*
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param hash The class to use for calulating hashes
* \return A initialized XMPPSCRAMAuth
*/
- initWithAuthcid: (OFString*)authcid
password: (OFString*)password
hash: (Class)hash;
/**
* Initializes an already allocated XMPPSCRAMAuth with a authzid,
* authcid and password.
*
* \param authzid The authzid to get authorization for
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param hash The class to use for calulating hashes
* \return A initialized XMPPSCRAMAuth
*/
- initWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
hash: (Class)hash;
- (OFString*)XMPP_genNonce;
- (uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key
data: (OFDataArray*)data;
- (OFDataArray*)XMPP_hiWithData: (OFDataArray *)str
salt: (OFDataArray *)salt_
iterationCount: (intmax_t)i;
|
>
>
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
>
>
>
|
>
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import <ObjFW/ObjFW.h>
#import "XMPPAuthenticator.h"
#import "XMPPConnection.h"
/**
* \brief A class to authenticate using SCRAM
*/
@interface XMPPSCRAMAuth: XMPPAuthenticator
{
Class hashType;
OFString *cNonce;
OFString *GS2Header;
OFString *clientFirstMessageBare;
OFDataArray *serverSignature;
XMPPConnection *connection;
BOOL plusAvailable;
}
/**
* Creates a new autoreleased XMPPSCRAMAuth with an authcid and password.
*
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param connection The connection over which authentication is done
* \param hash The class to use for calulating hashes
* \param plusAvailable Whether the PLUS variant was offered
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
plusAvailable: (BOOL)plusAvailable;
/**
* Creates a new autoreleased XMPPSCRAMAuth with an authzid,
* authcid and password.
*
* \param authzid The authzid to get authorization for
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param connection The connection over which authentication is done
* \param hash The class to use for calulating hashes
* \param plusAvailable Whether the PLUS variant was offered
* \return A new autoreleased XMPPSCRAMAuth
*/
+ SCRAMAuthWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
plusAvailable: (BOOL)plusAvailable;
/**
* Initializes an already allocated XMPPSCRAMAuth with an authcid and password.
*
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param connection The connection over which authentication is done
* \param hash The class to use for calulating hashes
* \param plusAvailable Whether the PLUS variant was offered
* \return A initialized XMPPSCRAMAuth
*/
- initWithAuthcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
plusAvailable: (BOOL)plusAvailable;
/**
* Initializes an already allocated XMPPSCRAMAuth with a authzid,
* authcid and password.
*
* \param authzid The authzid to get authorization for
* \param authcid The authcid to authenticate with
* \param password The password to authenticate with
* \param connection The connection over which authentication is done
* \param hash The class to use for calulating hashes
* \param plusAvailable Whether the PLUS variant was offered
* \return A initialized XMPPSCRAMAuth
*/
- initWithAuthzid: (OFString*)authzid
authcid: (OFString*)authcid
password: (OFString*)password
connection: (XMPPConnection*)connection
hash: (Class)hash
plusAvailable: (BOOL)plusAvailable;
- (OFString*)XMPP_genNonce;
- (uint8_t*)XMPP_HMACWithKey: (OFDataArray*)key
data: (OFDataArray*)data;
- (OFDataArray*)XMPP_hiWithData: (OFDataArray *)str
salt: (OFDataArray *)salt_
iterationCount: (intmax_t)i;
|