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