diff options
Diffstat (limited to 'camel/camel-cipher-context.h')
-rw-r--r-- | camel/camel-cipher-context.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h index 45444c26a0..5d9218b83e 100644 --- a/camel/camel-cipher-context.h +++ b/camel/camel-cipher-context.h @@ -24,9 +24,11 @@ #define CAMEL_CIPHER_CONTEXT_H #include <camel/camel-session.h> -#include <camel/camel-stream.h> #include <camel/camel-exception.h> +struct _CamelStream; +struct _CamelMimePart; + #ifdef __cplusplus extern "C" { #pragma } @@ -69,24 +71,23 @@ typedef struct _CamelCipherContextClass { const char * (*hash_to_id)(CamelCipherContext *context, CamelCipherHash hash); int (*sign) (CamelCipherContext *context, const char *userid, CamelCipherHash hash, - CamelStream *istream, CamelStream *ostream, CamelException *ex); + struct _CamelStream *istream, struct _CamelMimePart *sigpart, CamelException *ex); CamelCipherValidity * (*verify) (CamelCipherContext *context, CamelCipherHash hash, - CamelStream *istream, CamelStream *sigstream, + struct _CamelStream *istream, struct _CamelMimePart *sigpart, CamelException *ex); - int (*encrypt) (CamelCipherContext *context, gboolean sign, const char *userid, - GPtrArray *recipients, CamelStream *istream, CamelStream *ostream, + int (*encrypt) (CamelCipherContext *context, const char *userid, + GPtrArray *recipients, struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex); - int (*decrypt) (CamelCipherContext *context, CamelStream *istream, CamelStream *ostream, - CamelException *ex); + struct _CamelMimePart *(*decrypt) (CamelCipherContext *context, struct _CamelMimePart *ipart, CamelException *ex); - int (*import_keys) (CamelCipherContext *context, CamelStream *istream, + int (*import_keys) (CamelCipherContext *context, struct _CamelStream *istream, CamelException *ex); int (*export_keys) (CamelCipherContext *context, GPtrArray *keys, - CamelStream *ostream, CamelException *ex); + struct _CamelStream *ostream, CamelException *ex); } CamelCipherContextClass; CamelType camel_cipher_context_get_type (void); @@ -99,43 +100,36 @@ void camel_cipher_context_construct (CamelCipherContext *context CamelCipherHash camel_cipher_id_to_hash (CamelCipherContext *context, const char *id); const char * camel_cipher_hash_to_id (CamelCipherContext *context, CamelCipherHash hash); +/* FIXME: + There are some inconsistencies here, the api's should probably handle CamelMimePart's as input/outputs, + Something that might generate a multipart/signed should do it as part of that processing, internally + to the cipher, etc etc. */ + /* cipher routines */ int camel_cipher_sign (CamelCipherContext *context, const char *userid, CamelCipherHash hash, - CamelStream *istream, CamelStream *ostream, CamelException *ex); - + struct _CamelStream *istream, struct _CamelMimePart *sigpart, CamelException *ex); CamelCipherValidity *camel_cipher_verify (CamelCipherContext *context, CamelCipherHash hash, - CamelStream *istream, CamelStream *sigstream, + struct _CamelStream *istream, struct _CamelMimePart *sigpart, CamelException *ex); - -int camel_cipher_encrypt (CamelCipherContext *context, gboolean sign, const char *userid, - GPtrArray *recipients, CamelStream *istream, CamelStream *ostream, - CamelException *ex); - -int camel_cipher_decrypt (CamelCipherContext *context, CamelStream *istream, CamelStream *ostream, +int camel_cipher_encrypt (CamelCipherContext *context, const char *userid, + GPtrArray *recipients, struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex); +struct _CamelMimePart *camel_cipher_decrypt (CamelCipherContext *context, struct _CamelMimePart *ipart, CamelException *ex); /* key/certificate routines */ -int camel_cipher_import_keys (CamelCipherContext *context, CamelStream *istream, +int camel_cipher_import_keys (CamelCipherContext *context, struct _CamelStream *istream, CamelException *ex); - int camel_cipher_export_keys (CamelCipherContext *context, GPtrArray *keys, - CamelStream *ostream, CamelException *ex); + struct _CamelStream *ostream, CamelException *ex); /* CamelCipherValidity utility functions */ CamelCipherValidity *camel_cipher_validity_new (void); - void camel_cipher_validity_init (CamelCipherValidity *validity); - gboolean camel_cipher_validity_get_valid (CamelCipherValidity *validity); - void camel_cipher_validity_set_valid (CamelCipherValidity *validity, gboolean valid); - char *camel_cipher_validity_get_description (CamelCipherValidity *validity); - void camel_cipher_validity_set_description (CamelCipherValidity *validity, const char *description); - void camel_cipher_validity_clear (CamelCipherValidity *validity); - void camel_cipher_validity_free (CamelCipherValidity *validity); #ifdef __cplusplus |