27 #ifndef PURPLE_CIPHER_H
28 #define PURPLE_CIPHER_H
33 #define PURPLE_CIPHER(obj) ((PurpleCipher *)(obj))
34 #define PURPLE_CIPHER_OPS(obj) ((PurpleCipherOps *)(obj))
35 #define PURPLE_CIPHER_CONTEXT(obj) ((PurpleCipherContext *)(obj))
37 typedef struct _PurpleCipher PurpleCipher;
38 typedef struct _PurpleCipherOps PurpleCipherOps;
39 typedef struct _PurpleCipherContext PurpleCipherContext;
44 typedef enum _PurpleCipherBatchMode {
45 PURPLE_CIPHER_BATCH_MODE_ECB,
46 PURPLE_CIPHER_BATCH_MODE_CBC
170 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);
471 const gchar *algorithm,
const gchar *username,
472 const gchar *realm,
const gchar *password,
473 const gchar *nonce,
const gchar *client_nonce);
492 const gchar *algorithm,
const gchar *method,
493 const gchar *digest_uri,
const gchar *qop,
494 const gchar *entity,
const gchar *nonce,
495 const gchar *nonce_count,
const gchar *client_nonce,
496 const gchar *session_key);
void(* set_iv)(PurpleCipherContext *context, guchar *iv, size_t len)
The set initialization vector function.
gboolean purple_cipher_context_digest_to_str(PurpleCipherContext *context, size_t in_len, gchar digest_s[], size_t *out_len)
Converts a guchar digest into a hex string.
const gchar * purple_cipher_get_name(PurpleCipher *cipher)
Gets a cipher's name.
gint purple_cipher_context_decrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen)
Decrypts data using the context.
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)
Gets a digest from a cipher.
size_t(* get_salt_size)(PurpleCipherContext *context)
The get salt size function.
int(* encrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen)
The encrypt function.
void(* append)(PurpleCipherContext *context, const guchar *data, size_t len)
The append data function.
void purple_cipher_context_set_batch_mode(PurpleCipherContext *context, PurpleCipherBatchMode mode)
Sets the batch mode of a context.
size_t purple_cipher_context_get_key_size(PurpleCipherContext *context)
Gets the key size for a context.
void(* set_batch_mode)(PurpleCipherContext *context, PurpleCipherBatchMode mode)
The set batch mode function.
PurpleCipherContext * purple_cipher_context_new(PurpleCipher *cipher, void *extra)
Creates a new cipher context and initializes it.
gpointer purple_ciphers_get_handle(void)
Gets the handle to the cipher subsystem.
PurpleCipherContext * purple_cipher_context_new_by_name(const gchar *name, void *extra)
Creates a new cipher context by the cipher name and initializes it.
void purple_cipher_context_set_data(PurpleCipherContext *context, gpointer data)
Sets the cipher data for a context.
void purple_cipher_context_set_iv(PurpleCipherContext *context, guchar *iv, size_t len)
Sets the initialization vector for a context.
PurpleCipher * purple_ciphers_register_cipher(const gchar *name, PurpleCipherOps *ops)
Registers a cipher as a usable cipher.
enum _PurpleCipherBatchMode PurpleCipherBatchMode
Modes for batch encrypters.
gboolean(* digest)(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len)
The digest function.
void purple_cipher_context_set_key_with_len(PurpleCipherContext *context, const guchar *key, size_t len)
Sets the key with a given length on a context.
The set key with length flag.
void purple_ciphers_uninit(void)
Uninitializes the cipher core.
PurpleCipher * purple_ciphers_find_cipher(const gchar *name)
Finds a cipher by it's name.
void(* set_option)(PurpleCipherContext *context, const gchar *name, void *value)
The set option function.
size_t purple_cipher_context_get_salt_size(PurpleCipherContext *context)
Gets the size of the salt if the cipher supports it.
gchar * purple_cipher_http_digest_calculate_session_key(const gchar *algorithm, const gchar *username, const gchar *realm, const gchar *password, const gchar *nonce, const gchar *client_nonce)
Calculates a session key for HTTP Digest authentation.
struct _PurpleCipher PurpleCipher
A handle to a PurpleCipher.
void purple_cipher_context_reset(PurpleCipherContext *context, gpointer extra)
Resets a cipher context to it's default value.
gchar * purple_cipher_http_digest_calculate_response(const gchar *algorithm, const gchar *method, const gchar *digest_uri, const gchar *qop, const gchar *entity, const gchar *nonce, const gchar *nonce_count, const gchar *client_nonce, const gchar *session_key)
Calculate a response for HTTP Digest authentication.
struct _PurpleCipherContext PurpleCipherContext
A context for a PurpleCipher.
void(* reset)(PurpleCipherContext *context, void *extra)
The reset function.
gint purple_cipher_context_encrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen)
Encrypts data using the context.
The operations of a cipher.
void(* set_salt)(PurpleCipherContext *context, guchar *salt)
The set salt function.
void purple_cipher_context_destroy(PurpleCipherContext *context)
Destorys a cipher context and deinitializes it.
_PurpleCipherCaps
The operation flags for a cipher.
gboolean purple_cipher_context_digest(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len)
Digests a context.
gpointer purple_cipher_context_get_data(PurpleCipherContext *context)
Gets the cipher data for a context.
void purple_ciphers_init(void)
Initializes the cipher core.
gboolean purple_ciphers_unregister_cipher(PurpleCipher *cipher)
Unregisters a cipher.
void purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key)
Sets the key on a context.
void purple_cipher_context_set_salt(PurpleCipherContext *context, guchar *salt)
Sets the salt on a context.
int(* decrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen)
The decrypt function.
void(* init)(PurpleCipherContext *context, void *extra)
The init function.
void purple_cipher_context_append(PurpleCipherContext *context, const guchar *data, size_t len)
Appends data to the context.
void(* set_key)(PurpleCipherContext *context, const guchar *key)
The set key function.
guint purple_cipher_get_capabilities(PurpleCipher *cipher)
Gets a cipher's capabilities.
void(* uninit)(PurpleCipherContext *context)
The uninit function.
size_t(* get_block_size)(PurpleCipherContext *context)
The get block size function.
gpointer purple_cipher_context_get_option(PurpleCipherContext *context, const gchar *name)
Gets the vale of an option on a cipher context.
PurpleCipherBatchMode(* get_batch_mode)(PurpleCipherContext *context)
The get batch mode function.
size_t(* get_key_size)(PurpleCipherContext *context)
The get key size function.
enum _PurpleCipherCaps PurpleCipherCaps
The operation flags for a cipher.
void purple_cipher_context_set_option(PurpleCipherContext *context, const gchar *name, gpointer value)
Sets the value an option on a cipher context.
void(* set_key_with_len)(PurpleCipherContext *context, const guchar *key, size_t len)
The set key with length function.
size_t purple_cipher_context_get_block_size(PurpleCipherContext *context)
Gets the block size of a context.
GList * purple_ciphers_get_ciphers(void)
Gets the list of ciphers.
PurpleCipherBatchMode purple_cipher_context_get_batch_mode(PurpleCipherContext *context)
Gets the batch mode of a context.