From 52759f2d4018b8ff0ce173aa1237b08783f1424c Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 30 Oct 2003 04:58:33 +0000 Subject: Added a note about api inconsistencies. 2003-10-30 Not Zed * camel-cipher-context.h: Added a note about api inconsistencies. 2003-10-30 Not Zed * camel-multipart-encrypted.c (camel_multipart_encrypted_decrypt): fix for cipher_decrypt changes. * camel-gpg-context.c, camel-cipher-context.c: moved all the init code to the end to save having to keep forward declarations around. (camel_cipher_decrypt): changed to take mimepart input and return a mimepart. (gpg_decrypt): fix for changed args. 2003-10-29 Not Zed * camel-smime-context.[ch]: replaced entirely with a new implementation which inherits from camel-cipher-context, and add to build. * camel-multipart-encrypted.c (camel_multipart_encrypted_encrypt): fix for cipher_encrypt api changes. (camel_multipart_encrypted_decrypt): use g_ascii_strcasecmp. * camel-gpg-context.c (gpg_encrypt): Fix to handle input/output as parts not streams * camel-cipher-context.c (camel_cipher_encrypt): change to take mimeparts rather than streams as input/output. And remove the 'sign' argument, it is implied if userid is supplied. 2003-10-28 Not Zed * tests/smime/pgp.c (main): fix for ciphercontext api changes. * camel-multipart-signed.c (camel_multipart_signed_verify): pass in the part to cipher_verify directly. (camel_multipart_signed_sign): let the cipher context setup the part details. * camel-gpg-context.c (gpg_sign): put the signature stream into a mimepart, with appropriate headers/encoding. (swrite): write out a mimepart rather than a stream. (gpg_verify): handle changed args. * camel-cipher-context.c (camel_cipher_sign): write the signature to a mimepart rather than a simple stream. (camel_cipher_verify): take the signature as a mimepart not a stream. 2003-10-22 Not Zed * camel-utf8.c (camel_ucs2_utf8, camel_utf8_ucs2): helpers for ucs2 stuff. ucs2 is 16 bit truncated unicode. svn path=/trunk/; revision=23127 --- camel/camel-cipher-context.h | 50 +++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'camel/camel-cipher-context.h') 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 -#include #include +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 -- cgit