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