iptsec  1.13.17
auth_digest.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 #ifndef AUTH_DIGEST_H
27 #define AUTH_DIGEST_H
28 
46 #ifndef SU_ALLOC_H
47 #include <sofia-sip/su_alloc.h>
48 #endif
49 
50 SOFIA_BEGIN_DECLS
51 
75 typedef struct {
76  int ac_size;
77  char const *ac_realm;
78  char const *ac_domain;
79  char const *ac_nonce;
80  char const *ac_opaque;
81  char const *ac_algorithm;
82  char const *ac_qop;
83  unsigned ac_stale : 1;
84  unsigned ac_md5 : 1;
85  unsigned ac_md5sess : 1;
86  unsigned ac_sha1 : 1;
87  unsigned ac_sha256 : 1;
88  unsigned ac_sha256sess : 1;
89  unsigned ac_sha512_256 : 1;
90  unsigned ac_sha512_256sess : 1;
91  unsigned ac_auth : 1;
92  unsigned ac_auth_int : 1;
93  unsigned : 0;
95 
121 typedef struct {
122  int ar_size;
123  char const *ar_username;
124  char const *ar_realm;
125  char const *ar_nonce;
126  char const *ar_uri;
127  char const *ar_response;
128  char const *ar_algorithm;
129  char const *ar_cnonce;
130  char const *ar_opaque;
131  char const *ar_qop;
132  char const *ar_nc;
133  unsigned ar_md5 : 1;
134  unsigned ar_md5sess : 1;
135  unsigned ar_sha1 : 1;
136  unsigned ar_auth : 1;
137  unsigned ar_auth_int : 1;
138  unsigned : 0;
140 
141 typedef char auth_hexmd5_t[33];
142 
144  char const * const params[]);
146  auth_challenge_t *ac);
148  char const * const params[]);
149 
151  auth_hexmd5_t ha1,
152  char const *secret);
153 
154 SOFIAPUBFUN int auth_digest_a1sess(auth_response_t *ar,
155  auth_hexmd5_t ha1sess,
156  char const *ha1);
157 
158 SOFIAPUBFUN int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
159  char const *secret);
160 SOFIAPUBFUN int auth_digest_response(auth_response_t *, auth_hexmd5_t response,
161  auth_hexmd5_t const ha1,
162  char const *method_name,
163  void const *data, isize_t dlen);
164 
165 SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size);
166 
167 SOFIAPUBFUN int auth_strcmp(char const *quoted, char const *unquoted);
168 
169 SOFIA_END_DECLS
170 
171 #endif
issize_t auth_digest_challenge_get(su_home_t *, auth_challenge_t *, char const *const params[])
Get digest-challenge parameters.
Definition: auth_digest.c:61
issize_t auth_digest_response_get(su_home_t *, auth_response_t *, char const *const params[])
Get digest-response parameters.
Definition: auth_digest.c:147
int auth_strcmp(char const *quoted, char const *unquoted)
Compare two strings, even if they are quoted.
Definition: auth_common.c:180
int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1, char const *secret)
Generate MD5 session key for digest authentication.
Definition: auth_digest.c:263
void auth_digest_challenge_free_params(su_home_t *home, auth_challenge_t *ac)
Free challenge parameters.
Definition: auth_digest.c:120
int auth_digest_a1(auth_response_t *ar, auth_hexmd5_t ha1, char const *secret)
Generate A1 hash for digest authentication.
Definition: auth_digest.c:218
int auth_digest_response(auth_response_t *, auth_hexmd5_t response, auth_hexmd5_t const ha1, char const *method_name, void const *data, isize_t dlen)
Generate response for digest authentication.
Definition: auth_digest.c:288
Parameters for digest-challenge.
Definition: auth_digest.h:75
unsigned ac_sha256
algorithm=sha-256
Definition: auth_digest.h:87
unsigned ac_auth_int
qop=auth-int
Definition: auth_digest.h:92
unsigned ac_md5
algorithm=MS5 (or missing)
Definition: auth_digest.h:84
unsigned ac_auth
qop=auth
Definition: auth_digest.h:91
char const * ac_algorithm
algorithm
Definition: auth_digest.h:81
unsigned ac_sha256sess
algorithm=sha-256-sess
Definition: auth_digest.h:88
char const * ac_opaque
opaque
Definition: auth_digest.h:80
unsigned ac_sha1
algorithm=sha1 (SSA Hash)
Definition: auth_digest.h:86
unsigned ac_sha512_256sess
algorithm=sha-512-256-sess
Definition: auth_digest.h:90
unsigned ac_sha512_256
algorithm=sha-512-256
Definition: auth_digest.h:89
unsigned ac_stale
stale=true
Definition: auth_digest.h:83
unsigned ac_md5sess
algorithm=MD5-sess
Definition: auth_digest.h:85
char const * ac_nonce
nonce
Definition: auth_digest.h:79
char const * ac_domain
domain
Definition: auth_digest.h:78
char const * ac_realm
realm
Definition: auth_digest.h:77
char const * ac_qop
qop
Definition: auth_digest.h:82
Digest parameters for digest-response in Authorize.
Definition: auth_digest.h:121
char const * ar_uri
uri
Definition: auth_digest.h:126
unsigned ar_auth
qop=auth
Definition: auth_digest.h:136
char const * ar_algorithm
algorithm
Definition: auth_digest.h:128
char const * ar_nc
nonce count
Definition: auth_digest.h:132
unsigned ar_md5
MS5 algorithm.
Definition: auth_digest.h:133
char const * ar_realm
realm
Definition: auth_digest.h:124
unsigned ar_auth_int
qop=auth-int
Definition: auth_digest.h:137
char const * ar_qop
qop
Definition: auth_digest.h:131
char const * ar_nonce
nonce
Definition: auth_digest.h:125
char const * ar_cnonce
cnonce
Definition: auth_digest.h:129
char const * ar_response
response
Definition: auth_digest.h:127
unsigned ar_md5sess
MD5-sess algorithm.
Definition: auth_digest.h:134
char const * ar_opaque
opaque
Definition: auth_digest.h:130
unsigned ar_sha1
SHA1 algorithm.
Definition: auth_digest.h:135
SU_HOME_T su_home_t
#define SOFIAPUBFUN

Sofia-SIP 1.13.17 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.