iptsec  1.12.11devel
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
26 
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_auth : 1;
88  unsigned ac_auth_int : 1;
89  unsigned : 0;
91 
117 typedef struct {
118  int ar_size;
119  char const *ar_username;
120  char const *ar_realm;
121  char const *ar_nonce;
122  char const *ar_uri;
123  char const *ar_response;
124  char const *ar_algorithm;
125  char const *ar_cnonce;
126  char const *ar_opaque;
127  char const *ar_qop;
128  char const *ar_nc;
129  unsigned ar_md5 : 1;
130  unsigned ar_md5sess : 1;
131  unsigned ar_sha1 : 1;
132  unsigned ar_auth : 1;
133  unsigned ar_auth_int : 1;
134  unsigned : 0;
136 
137 typedef char auth_hexmd5_t[33];
138 
140  char const * const params[]);
142  auth_challenge_t *ac);
144  char const * const params[]);
145 
146 SOFIAPUBFUN int auth_digest_ha1(auth_hexmd5_t ha1,
147  char const *username,
148  char const *realm,
149  char const *secret);
150 
152  auth_hexmd5_t ha1,
153  char const *secret);
154 
155 SOFIAPUBFUN int auth_digest_a1sess(auth_response_t *ar,
156  auth_hexmd5_t ha1sess,
157  char const *ha1);
158 
159 SOFIAPUBFUN int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
160  char const *secret);
161 
162 SOFIAPUBFUN int auth_digest_response(auth_response_t *, auth_hexmd5_t response,
163  auth_hexmd5_t const ha1,
164  char const *method_name,
165  void const *data, isize_t dlen);
166 
167 SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size);
168 
169 SOFIAPUBFUN int auth_strcmp(char const *quoted, char const *unquoted);
170 
171 SOFIA_END_DECLS
172 
173 #endif
su_home_t
SU_HOME_T su_home_t
auth_digest_ha1
int auth_digest_ha1(auth_hexmd5_t ha1, char const *username, char const *realm, char const *secret)
Generate the hex A1 hash for digest authentication.
Definition: auth_digest.c:208
auth_challenge_t::ac_stale
unsigned ac_stale
stale=true
Definition: auth_digest.h:83
auth_digest_a1
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:233
auth_challenge_t::ac_auth
unsigned ac_auth
qop=auth
Definition: auth_digest.h:87
auth_response_t::ar_realm
const char * ar_realm
realm
Definition: auth_digest.h:120
auth_challenge_t::ac_qop
const char * ac_qop
qop
Definition: auth_digest.h:82
auth_response_t::ar_qop
const char * ar_qop
qop
Definition: auth_digest.h:127
auth_response_t::ar_cnonce
const char * ar_cnonce
cnonce
Definition: auth_digest.h:125
auth_response_t::ar_uri
const char * ar_uri
uri
Definition: auth_digest.h:122
auth_response_t::ar_opaque
const char * ar_opaque
opaque
Definition: auth_digest.h:126
auth_challenge_t::ac_md5sess
unsigned ac_md5sess
algorithm=MD5-sess
Definition: auth_digest.h:85
auth_challenge_t::ac_nonce
const char * ac_nonce
nonce
Definition: auth_digest.h:79
auth_response_t
Digest parameters for digest-response in Authorize.
Definition: auth_digest.h:117
auth_response_t::ar_nc
const char * ar_nc
nonce count
Definition: auth_digest.h:128
auth_challenge_t::ac_domain
const char * ac_domain
domain
Definition: auth_digest.h:78
auth_digest_challenge_free_params
void auth_digest_challenge_free_params(su_home_t *home, auth_challenge_t *ac)
Free challenge parameters.
Definition: auth_digest.c:111
auth_strcmp
int auth_strcmp(char const *quoted, char const *unquoted)
Compare two strings, even if they are quoted.
Definition: auth_common.c:180
auth_challenge_t::ac_auth_int
unsigned ac_auth_int
qop=auth-int
Definition: auth_digest.h:88
SOFIAPUBFUN
#define SOFIAPUBFUN
auth_response_t::ar_md5sess
unsigned ar_md5sess
MD5-sess algorithm.
Definition: auth_digest.h:130
su_alloc.h
auth_digest_response
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
auth_response_t::ar_nonce
const char * ar_nonce
nonce
Definition: auth_digest.h:121
auth_digest_sessionkey
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
auth_response_t::ar_response
const char * ar_response
response
Definition: auth_digest.h:123
auth_challenge_t::ac_md5
unsigned ac_md5
algorithm=MS5 (or missing)
Definition: auth_digest.h:84
auth_challenge_t::ac_algorithm
const char * ac_algorithm
algorithm
Definition: auth_digest.h:81
auth_response_t::ar_auth
unsigned ar_auth
qop=auth
Definition: auth_digest.h:132
auth_digest_response_get
issize_t auth_digest_response_get(su_home_t *, auth_response_t *, char const *const params[])
Get digest-response parameters.
Definition: auth_digest.c:138
auth_challenge_t::ac_opaque
const char * ac_opaque
opaque
Definition: auth_digest.h:80
auth_response_t::ar_auth_int
unsigned ar_auth_int
qop=auth-int
Definition: auth_digest.h:133
auth_response_t::ar_sha1
unsigned ar_sha1
SHA1 algorithm.
Definition: auth_digest.h:131
auth_response_t::ar_md5
unsigned ar_md5
MS5 algorithm.
Definition: auth_digest.h:129
auth_challenge_t::ac_realm
const char * ac_realm
realm
Definition: auth_digest.h:77
auth_challenge_t
Parameters for digest-challenge.
Definition: auth_digest.h:75
auth_response_t::ar_algorithm
const char * ar_algorithm
algorithm
Definition: auth_digest.h:124
auth_digest_challenge_get
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
auth_challenge_t::ac_sha1
unsigned ac_sha1
algorithm=sha1 (SSA Hash)
Definition: auth_digest.h:86

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