Fri, 29 Jun 2007 15:30:22 +0000
Add links to the signal documents in the API documents.
| 10684 | 1 | /** |
| 15884 | 2 | * @file cipher.h Purple Cipher API |
| 10684 | 3 | * @ingroup core |
| 4 | * | |
| 15884 | 5 | * purple |
| 10684 | 6 | * |
| 15884 | 7 | * Purple is the legal property of its developers, whose names are too numerous |
| 10684 | 8 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 9 | * source distribution. | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18412
6873322c380f
Add links to the signal documents in the API documents.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16743
diff
changeset
|
24 | * |
|
6873322c380f
Add links to the signal documents in the API documents.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16743
diff
changeset
|
25 | * @see @ref cipher-signals |
| 10684 | 26 | */ |
| 15884 | 27 | #ifndef PURPLE_CIPHER_H |
| 28 | #define PURPLE_CIPHER_H | |
| 10684 | 29 | |
| 30 | #include <glib.h> | |
| 31 | ||
| 15884 | 32 | #define PURPLE_CIPHER(obj) ((PurpleCipher *)(obj)) /**< PurpleCipher typecast helper */ |
| 33 | #define PURPLE_CIPHER_OPS(obj) ((PurpleCipherOps *)(obj)) /**< PurpleCipherInfo typecase helper */ | |
| 34 | #define PURPLE_CIPHER_CONTEXT(obj) ((PurpleCipherContext *)(obj)) /**< PurpleCipherContext typecast helper */ | |
| 10684 | 35 | |
| 15884 | 36 | typedef struct _PurpleCipher PurpleCipher; /**< A handle to a PurpleCipher */ |
| 37 | typedef struct _PurpleCipherOps PurpleCipherOps; /**< Ops for a PurpleCipher */ | |
| 38 | typedef struct _PurpleCipherContext PurpleCipherContext; /**< A context for a PurpleCipher */ | |
| 10684 | 39 | |
| 40 | ||
| 41 | /** | |
| 42 | * The operation flags for a cipher | |
| 43 | */ | |
| 15884 | 44 | typedef enum _PurpleCipherCaps { |
| 45 | PURPLE_CIPHER_CAPS_SET_OPT = 1 << 1, /**< Set option flag */ | |
| 46 | PURPLE_CIPHER_CAPS_GET_OPT = 1 << 2, /**< Get option flag */ | |
| 47 | PURPLE_CIPHER_CAPS_INIT = 1 << 3, /**< Init flag */ | |
| 48 | PURPLE_CIPHER_CAPS_RESET = 1 << 4, /**< Reset flag */ | |
| 49 | PURPLE_CIPHER_CAPS_UNINIT = 1 << 5, /**< Uninit flag */ | |
| 50 | PURPLE_CIPHER_CAPS_SET_IV = 1 << 6, /**< Set IV flag */ | |
| 51 | PURPLE_CIPHER_CAPS_APPEND = 1 << 7, /**< Append flag */ | |
| 52 | PURPLE_CIPHER_CAPS_DIGEST = 1 << 8, /**< Digest flag */ | |
| 53 | PURPLE_CIPHER_CAPS_ENCRYPT = 1 << 9, /**< Encrypt flag */ | |
| 54 | PURPLE_CIPHER_CAPS_DECRYPT = 1 << 10, /**< Decrypt flag */ | |
| 55 | PURPLE_CIPHER_CAPS_SET_SALT = 1 << 11, /**< Set salt flag */ | |
| 56 | PURPLE_CIPHER_CAPS_GET_SALT_SIZE = 1 << 12, /**< Get salt size flag */ | |
| 57 | PURPLE_CIPHER_CAPS_SET_KEY = 1 << 13, /**< Set key flag */ | |
| 58 | PURPLE_CIPHER_CAPS_GET_KEY_SIZE = 1 << 14, /**< Get key size flag */ | |
| 59 | PURPLE_CIPHER_CAPS_UNKNOWN = 1 << 16 /**< Unknown */ | |
| 60 | } PurpleCipherCaps; | |
| 10684 | 61 | |
| 62 | /** | |
| 63 | * The operations of a cipher. Every cipher must implement one of these. | |
| 64 | */ | |
| 15884 | 65 | struct _PurpleCipherOps { |
| 10684 | 66 | /** The set option function */ |
| 15884 | 67 | void (*set_option)(PurpleCipherContext *context, const gchar *name, void *value); |
| 10684 | 68 | |
| 69 | /** The get option function */ | |
| 15884 | 70 | void *(*get_option)(PurpleCipherContext *context, const gchar *name); |
| 10684 | 71 | |
| 72 | /** The init function */ | |
| 15884 | 73 | void (*init)(PurpleCipherContext *context, void *extra); |
| 10684 | 74 | |
| 75 | /** The reset function */ | |
| 15884 | 76 | void (*reset)(PurpleCipherContext *context, void *extra); |
| 10684 | 77 | |
| 78 | /** The uninit function */ | |
| 15884 | 79 | void (*uninit)(PurpleCipherContext *context); |
| 10684 | 80 | |
| 81 | /** The set initialization vector function */ | |
| 15884 | 82 | void (*set_iv)(PurpleCipherContext *context, guchar *iv, size_t len); |
| 10684 | 83 | |
| 84 | /** The append data function */ | |
| 15884 | 85 | void (*append)(PurpleCipherContext *context, const guchar *data, size_t len); |
| 10684 | 86 | |
| 87 | /** The digest function */ | |
| 15884 | 88 | gboolean (*digest)(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len); |
| 10684 | 89 | |
| 90 | /** The encrypt function */ | |
| 15884 | 91 | int (*encrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); |
| 10684 | 92 | |
| 93 | /** The decrypt function */ | |
| 15884 | 94 | int (*decrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); |
| 10684 | 95 | |
| 96 | /** The set salt function */ | |
| 15884 | 97 | void (*set_salt)(PurpleCipherContext *context, guchar *salt); |
| 10684 | 98 | |
| 99 | /** The get salt size function */ | |
| 15884 | 100 | size_t (*get_salt_size)(PurpleCipherContext *context); |
| 10684 | 101 | |
| 102 | /** The set key function */ | |
| 15884 | 103 | void (*set_key)(PurpleCipherContext *context, const guchar *key); |
| 10684 | 104 | |
| 105 | /** The get key size function */ | |
| 15884 | 106 | size_t (*get_key_size)(PurpleCipherContext *context); |
|
16743
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
107 | |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
108 | void (*_purple_reserved1)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
109 | void (*_purple_reserved2)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
110 | void (*_purple_reserved3)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
111 | void (*_purple_reserved4)(void); |
| 10684 | 112 | }; |
| 113 | ||
| 114 | #ifdef __cplusplus | |
| 115 | extern "C" { | |
| 116 | #endif /* __cplusplus */ | |
| 117 | ||
| 118 | /*****************************************************************************/ | |
| 15884 | 119 | /** @name PurpleCipher API */ |
| 10684 | 120 | /*****************************************************************************/ |
| 121 | /*@{*/ | |
| 122 | ||
| 123 | /** | |
| 124 | * Gets a cipher's name | |
| 125 | * | |
| 126 | * @param cipher The cipher handle | |
| 127 | * | |
| 128 | * @return The cipher's name | |
| 129 | */ | |
| 15884 | 130 | const gchar *purple_cipher_get_name(PurpleCipher *cipher); |
| 10684 | 131 | |
| 132 | /** | |
| 133 | * Gets a cipher's capabilities | |
| 134 | * | |
| 135 | * @param cipher The cipher handle | |
| 136 | * | |
| 137 | * @return The cipher's info | |
| 138 | */ | |
| 15884 | 139 | guint purple_cipher_get_capabilities(PurpleCipher *cipher); |
| 10684 | 140 | |
| 141 | /** | |
| 142 | * Gets a digest from a cipher | |
| 143 | * | |
| 10687 | 144 | * @param name The cipher's name |
| 145 | * @param data The data to hash | |
| 146 | * @param data_len The length of the data | |
| 147 | * @param in_len The length of the buffer | |
| 148 | * @param digest The returned digest | |
| 149 | * @param out_len The length written | |
| 150 | * | |
| 151 | * @return @c TRUE if successful, @c FALSE otherwise | |
| 10684 | 152 | */ |
| 15884 | 153 | gboolean purple_cipher_digest_region(const gchar *name, const guchar *data, size_t data_len, size_t in_len, guchar digest[], size_t *out_len); |
| 10684 | 154 | |
| 155 | /*@}*/ | |
| 156 | /******************************************************************************/ | |
| 15884 | 157 | /** @name PurpleCiphers API */ |
| 10684 | 158 | /******************************************************************************/ |
| 159 | /*@{*/ | |
| 160 | ||
| 161 | /** | |
| 162 | * Finds a cipher by it's name | |
| 163 | * | |
| 164 | * @param name The name of the cipher to find | |
| 165 | * | |
| 166 | * @return The cipher handle or @c NULL | |
| 167 | */ | |
| 15884 | 168 | PurpleCipher *purple_ciphers_find_cipher(const gchar *name); |
| 10684 | 169 | |
| 170 | /** | |
| 171 | * Registers a cipher as a usable cipher | |
| 172 | * | |
| 173 | * @param name The name of the new cipher | |
| 174 | * @param ops The cipher ops to register | |
| 175 | * | |
| 176 | * @return The handle to the new cipher or @c NULL if it failed | |
| 177 | */ | |
| 15884 | 178 | PurpleCipher *purple_ciphers_register_cipher(const gchar *name, PurpleCipherOps *ops); |
| 10684 | 179 | |
| 180 | /** | |
| 181 | * Unregisters a cipher | |
| 182 | * | |
| 183 | * @param cipher The cipher handle to unregister | |
| 184 | * | |
| 185 | * @return Whether or not the cipher was successfully unloaded | |
| 186 | */ | |
| 15884 | 187 | gboolean purple_ciphers_unregister_cipher(PurpleCipher *cipher); |
| 10684 | 188 | |
| 189 | /** | |
| 190 | * Gets the list of ciphers | |
| 191 | * | |
| 192 | * @return The list of available ciphers | |
| 193 | * @note This list should not be modified, it is owned by the cipher core | |
| 194 | */ | |
| 15884 | 195 | GList *purple_ciphers_get_ciphers(void); |
| 10684 | 196 | |
| 197 | /*@}*/ | |
| 198 | /******************************************************************************/ | |
| 15884 | 199 | /** @name PurpleCipher Subsystem API */ |
| 10684 | 200 | /******************************************************************************/ |
| 201 | /*@{*/ | |
| 202 | ||
| 203 | /** | |
| 204 | * Gets the handle to the cipher subsystem | |
| 205 | * | |
| 206 | * @return The handle to the cipher subsystem | |
| 207 | */ | |
| 15884 | 208 | gpointer purple_ciphers_get_handle(void); |
| 10684 | 209 | |
| 210 | /** | |
| 211 | * Initializes the cipher core | |
| 212 | */ | |
| 15884 | 213 | void purple_ciphers_init(void); |
| 10684 | 214 | |
| 215 | /** | |
| 216 | * Uninitializes the cipher core | |
| 217 | */ | |
| 15884 | 218 | void purple_ciphers_uninit(void); |
| 10684 | 219 | |
| 220 | /*@}*/ | |
| 221 | /******************************************************************************/ | |
| 15884 | 222 | /** @name PurpleCipherContext API */ |
| 10684 | 223 | /******************************************************************************/ |
| 224 | /*@{*/ | |
| 225 | ||
| 226 | /** | |
| 227 | * Sets the value an option on a cipher context | |
| 228 | * | |
| 229 | * @param context The cipher context | |
| 230 | * @param name The name of the option | |
| 231 | * @param value The value to set | |
| 232 | */ | |
| 15884 | 233 | void purple_cipher_context_set_option(PurpleCipherContext *context, const gchar *name, gpointer value); |
| 10684 | 234 | |
| 235 | /** | |
| 236 | * Gets the vale of an option on a cipher context | |
| 237 | * | |
| 238 | * @param context The cipher context | |
| 239 | * @param name The name of the option | |
| 240 | * @return The value of the option | |
| 241 | */ | |
| 15884 | 242 | gpointer purple_cipher_context_get_option(PurpleCipherContext *context, const gchar *name); |
| 10684 | 243 | |
| 244 | /** | |
| 245 | * Creates a new cipher context and initializes it | |
| 246 | * | |
| 247 | * @param cipher The cipher to use | |
| 248 | * @param extra Extra data for the specific cipher | |
| 249 | * | |
| 250 | * @return The new cipher context | |
| 251 | */ | |
| 15884 | 252 | PurpleCipherContext *purple_cipher_context_new(PurpleCipher *cipher, void *extra); |
| 10684 | 253 | |
| 254 | /** | |
| 255 | * Creates a new cipher context by the cipher name and initializes it | |
| 256 | * | |
| 257 | * @param name The cipher's name | |
| 258 | * @param extra Extra data for the specific cipher | |
| 259 | * | |
| 260 | * @return The new cipher context | |
| 261 | */ | |
| 15884 | 262 | PurpleCipherContext *purple_cipher_context_new_by_name(const gchar *name, void *extra); |
| 10684 | 263 | |
| 264 | /** | |
| 265 | * Resets a cipher context to it's default value | |
| 266 | * @note If you have set an IV you will have to set it after resetting | |
| 267 | * | |
| 268 | * @param context The context to reset | |
| 269 | * @param extra Extra data for the specific cipher | |
| 270 | */ | |
| 15884 | 271 | void purple_cipher_context_reset(PurpleCipherContext *context, gpointer extra); |
| 10684 | 272 | |
| 273 | /** | |
| 274 | * Destorys a cipher context and deinitializes it | |
| 275 | * | |
| 276 | * @param context The cipher context to destory | |
| 277 | */ | |
| 15884 | 278 | void purple_cipher_context_destroy(PurpleCipherContext *context); |
| 10684 | 279 | |
| 280 | /** | |
| 281 | * Sets the initialization vector for a context | |
| 282 | * @note This should only be called right after a cipher context is created or reset | |
| 283 | * | |
| 284 | * @param context The context to set the IV to | |
| 285 | * @param iv The initialization vector to set | |
| 286 | * @param len The len of the IV | |
| 287 | */ | |
| 15884 | 288 | void purple_cipher_context_set_iv(PurpleCipherContext *context, guchar *iv, size_t len); |
| 10684 | 289 | |
| 290 | /** | |
| 291 | * Appends data to the context | |
| 292 | * | |
| 293 | * @param context The context to append data to | |
| 294 | * @param data The data to append | |
| 295 | * @param len The length of the data | |
| 296 | */ | |
| 15884 | 297 | void purple_cipher_context_append(PurpleCipherContext *context, const guchar *data, size_t len); |
| 10684 | 298 | |
| 299 | /** | |
| 300 | * Digests a context | |
| 301 | * | |
| 302 | * @param context The context to digest | |
| 10687 | 303 | * @param in_len The length of the buffer |
| 10684 | 304 | * @param digest The return buffer for the digest |
| 10687 | 305 | * @param out_len The length of the returned value |
| 10684 | 306 | */ |
| 15884 | 307 | gboolean purple_cipher_context_digest(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len); |
| 10684 | 308 | |
| 309 | /** | |
|
11183
be87fe695c93
[gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents:
10687
diff
changeset
|
310 | * Converts a guchar digest into a hex string |
| 10684 | 311 | * |
| 312 | * @param context The context to get a digest from | |
| 10687 | 313 | * @param in_len The length of the buffer |
| 10684 | 314 | * @param digest_s The return buffer for the string digest |
| 10687 | 315 | * @param out_len The length of the returned value |
| 10684 | 316 | */ |
| 15884 | 317 | gboolean purple_cipher_context_digest_to_str(PurpleCipherContext *context, size_t in_len, gchar digest_s[], size_t *out_len); |
| 10684 | 318 | |
| 319 | /** | |
| 320 | * Encrypts data using the context | |
| 321 | * | |
| 322 | * @param context The context | |
| 323 | * @param data The data to encrypt | |
| 324 | * @param len The length of the data | |
| 325 | * @param output The output buffer | |
| 326 | * @param outlen The len of data that was outputed | |
| 327 | * | |
| 328 | * @return A cipher specific status code | |
| 329 | */ | |
| 15884 | 330 | gint purple_cipher_context_encrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); |
| 10684 | 331 | |
| 332 | /** | |
| 333 | * Decrypts data using the context | |
| 334 | * | |
| 335 | * @param context The context | |
| 336 | * @param data The data to encrypt | |
| 337 | * @param len The length of the returned value | |
| 338 | * @param output The output buffer | |
| 339 | * @param outlen The len of data that was outputed | |
| 340 | * | |
| 341 | * @return A cipher specific status code | |
| 342 | */ | |
| 15884 | 343 | gint purple_cipher_context_decrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); |
| 10684 | 344 | |
| 345 | /** | |
| 346 | * Sets the salt on a context | |
| 347 | * | |
| 348 | * @param context The context who's salt to set | |
| 349 | * @param salt The salt | |
| 350 | */ | |
| 15884 | 351 | void purple_cipher_context_set_salt(PurpleCipherContext *context, guchar *salt); |
| 10684 | 352 | |
| 353 | /** | |
| 354 | * Gets the size of the salt if the cipher supports it | |
| 355 | * | |
| 356 | * @param context The context who's salt size to get | |
| 357 | * | |
| 358 | * @return The size of the salt | |
| 359 | */ | |
| 15884 | 360 | size_t purple_cipher_context_get_salt_size(PurpleCipherContext *context); |
| 10684 | 361 | |
| 362 | /** | |
| 363 | * Sets the key on a context | |
| 364 | * | |
| 365 | * @param context The context who's key to set | |
| 366 | * @param key The key | |
| 367 | */ | |
| 15884 | 368 | void purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key); |
| 10684 | 369 | |
| 370 | /** | |
| 371 | * Gets the key size for a context | |
| 372 | * | |
| 373 | * @param context The context who's key size to get | |
| 374 | * | |
| 375 | * @return The size of the key | |
| 376 | */ | |
| 15884 | 377 | size_t purple_cipher_context_get_key_size(PurpleCipherContext *context); |
| 10684 | 378 | |
| 379 | /** | |
| 380 | * Sets the cipher data for a context | |
| 381 | * | |
| 382 | * @param context The context who's cipher data to set | |
| 383 | * @param data The cipher data to set | |
| 384 | */ | |
| 15884 | 385 | void purple_cipher_context_set_data(PurpleCipherContext *context, gpointer data); |
| 10684 | 386 | |
| 387 | /** | |
| 388 | * Gets the cipher data for a context | |
| 389 | * | |
| 390 | * @param context The context who's cipher data to get | |
| 391 | * | |
| 392 | * @return The cipher data | |
| 393 | */ | |
| 15884 | 394 | gpointer purple_cipher_context_get_data(PurpleCipherContext *context); |
| 10684 | 395 | |
|
12388
3a25d96abdaf
[gaim-migrate @ 14694]
Richard Laager <rlaager@pidgin.im>
parents:
12382
diff
changeset
|
396 | /*@}*/ |
|
3a25d96abdaf
[gaim-migrate @ 14694]
Richard Laager <rlaager@pidgin.im>
parents:
12382
diff
changeset
|
397 | /*****************************************************************************/ |
| 15884 | 398 | /** @name Purple Cipher HTTP Digest Helper Functions */ |
|
12388
3a25d96abdaf
[gaim-migrate @ 14694]
Richard Laager <rlaager@pidgin.im>
parents:
12382
diff
changeset
|
399 | /*****************************************************************************/ |
|
3a25d96abdaf
[gaim-migrate @ 14694]
Richard Laager <rlaager@pidgin.im>
parents:
12382
diff
changeset
|
400 | /*@{*/ |
|
3a25d96abdaf
[gaim-migrate @ 14694]
Richard Laager <rlaager@pidgin.im>
parents:
12382
diff
changeset
|
401 | |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
402 | /** |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
403 | * Calculates a session key for HTTP Digest authentation |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
404 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
405 | * See RFC 2617 for more information. |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
406 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
407 | * @param algorithm The hash algorithm to use |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
408 | * @param username The username provided by the user |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
409 | * @param realm The authentication realm provided by the server |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
410 | * @param password The password provided by the user |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
411 | * @param nonce The nonce provided by the server |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
412 | * @param client_nonce The nonce provided by the client |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
413 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
414 | * @return The session key, or @c NULL if an error occurred. |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
415 | */ |
| 15884 | 416 | gchar *purple_cipher_http_digest_calculate_session_key( |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
417 | const gchar *algorithm, const gchar *username, |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
418 | const gchar *realm, const gchar *password, |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
419 | const gchar *nonce, const gchar *client_nonce); |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
420 | |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
421 | /** Calculate a response for HTTP Digest authentication |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
422 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
423 | * See RFC 2617 for more information. |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
424 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
425 | * @param algorithm The hash algorithm to use |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
426 | * @param method The HTTP method in use |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
427 | * @param digest_uri The URI from the initial request |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
428 | * @param qop The "quality of protection" |
|
12389
7196ba664097
[gaim-migrate @ 14695]
Richard Laager <rlaager@pidgin.im>
parents:
12388
diff
changeset
|
429 | * @param entity The entity body |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
430 | * @param nonce The nonce provided by the server |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
431 | * @param nonce_count The nonce count |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
432 | * @param client_nonce The nonce provided by the client |
| 15884 | 433 | * @param session_key The session key from purple_cipher_http_digest_calculate_session_key() |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
434 | * |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
435 | * @return The hashed response, or @c NULL if an error occurred. |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
436 | */ |
| 15884 | 437 | gchar *purple_cipher_http_digest_calculate_response( |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
438 | const gchar *algorithm, const gchar *method, |
|
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
439 | const gchar *digest_uri, const gchar *qop, |
|
12389
7196ba664097
[gaim-migrate @ 14695]
Richard Laager <rlaager@pidgin.im>
parents:
12388
diff
changeset
|
440 | const gchar *entity, const gchar *nonce, |
|
7196ba664097
[gaim-migrate @ 14695]
Richard Laager <rlaager@pidgin.im>
parents:
12388
diff
changeset
|
441 | const gchar *nonce_count, const gchar *client_nonce, |
|
7196ba664097
[gaim-migrate @ 14695]
Richard Laager <rlaager@pidgin.im>
parents:
12388
diff
changeset
|
442 | const gchar *session_key); |
|
12382
5ef67596b420
[gaim-migrate @ 14688]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
443 | |
| 10684 | 444 | /*@}*/ |
| 445 | ||
| 446 | #ifdef __cplusplus | |
| 447 | } | |
| 448 | #endif /* __cplusplus */ | |
| 449 | ||
| 15884 | 450 | #endif /* PURPLE_CIPHER_H */ |