aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-cipher-context.h
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-11-10 20:46:07 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-11-10 20:46:07 +0800
commitbb90a934d50682e2ffc93d307664b20e6e54bee7 (patch)
treef4b5dd08ce90c3354a3a35892a71592173ba7535 /camel/camel-cipher-context.h
parent55e9c607f0bac0a0333552885d97d45c5122bd59 (diff)
downloadgsoc2013-evolution-bb90a934d50682e2ffc93d307664b20e6e54bee7.tar.gz
gsoc2013-evolution-bb90a934d50682e2ffc93d307664b20e6e54bee7.tar.zst
gsoc2013-evolution-bb90a934d50682e2ffc93d307664b20e6e54bee7.zip
split out the CMSMessage verification code so it can be used from
2003-11-10 Not Zed <NotZed@Ximian.com> * camel-smime-context.c (sm_verify_cmsg): split out the CMSMessage verification code so it can be used from enveloped or externally signed data. * camel-cipher-context.c (camel_cipher_verify): only take a mimepart, internally handle multiparts and the hash. 2003-11-07 Not Zed <NotZed@Ximian.com> * camel-cipher-context.c: make ciphervalidity a public structure, added encrypt status. (camel_cipher_decrypt): changed to return a ciphervalidity. fixed implementations. (camel_cipher_validity_*): Fixed implementations to match new structure, some of this is now redundant. 2003-11-06 Not Zed <NotZed@Ximian.com> * camel-smime-context.c (camel_smime_context_describe_part): implement. svn path=/trunk/; revision=23242
Diffstat (limited to 'camel/camel-cipher-context.h')
-rw-r--r--camel/camel-cipher-context.h42
1 files changed, 33 insertions, 9 deletions
diff --git a/camel/camel-cipher-context.h b/camel/camel-cipher-context.h
index db83e92438..d3aea4c6b0 100644
--- a/camel/camel-cipher-context.h
+++ b/camel/camel-cipher-context.h
@@ -51,6 +51,31 @@ typedef enum {
CAMEL_CIPHER_HASH_HAVAL5160
} CamelCipherHash;
+enum _camel_cipher_validity_sign_t {
+ CAMEL_CIPHER_VALIDITY_SIGN_NONE,
+ CAMEL_CIPHER_VALIDITY_SIGN_GOOD,
+ CAMEL_CIPHER_VALIDITY_SIGN_BAD,
+ CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN,
+};
+
+enum _camel_cipher_validity_encrypt_t {
+ CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE,
+ CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK,
+ CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, /* encrypted, unknown strenght */
+ CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG,
+};
+
+struct _CamelCipherValidity {
+ struct {
+ enum _camel_cipher_validity_sign_t status;
+ char *description;
+ } sign;
+ struct {
+ enum _camel_cipher_validity_encrypt_t status;
+ char *description;
+ } encrypt;
+};
+
typedef struct _CamelCipherContext {
CamelObject parent_object;
@@ -73,15 +98,14 @@ typedef struct _CamelCipherContextClass {
int (*sign) (CamelCipherContext *context, const char *userid, CamelCipherHash hash,
struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex);
- CamelCipherValidity * (*verify) (CamelCipherContext *context, CamelCipherHash hash,
- struct _CamelStream *istream, struct _CamelMimePart *sigpart,
- CamelException *ex);
+ CamelCipherValidity * (*verify) (CamelCipherContext *context, struct _CamelMimePart *ipart, CamelException *ex);
int (*encrypt) (CamelCipherContext *context, const char *userid,
GPtrArray *recipients, struct _CamelMimePart *ipart, struct _CamelMimePart *opart,
CamelException *ex);
- struct _CamelMimePart *(*decrypt) (CamelCipherContext *context, struct _CamelMimePart *ipart, CamelException *ex);
+ CamelCipherValidity *(*decrypt) (CamelCipherContext *context, struct _CamelMimePart *ipart, struct _CamelMimePart *opart,
+ CamelException *ex);
int (*import_keys) (CamelCipherContext *context, struct _CamelStream *istream,
CamelException *ex);
@@ -108,13 +132,12 @@ const char * camel_cipher_hash_to_id (CamelCipherContext *context, CamelCip
/* cipher routines */
int camel_cipher_sign (CamelCipherContext *context, const char *userid, CamelCipherHash hash,
struct _CamelMimePart *ipart, struct _CamelMimePart *opart, CamelException *ex);
-CamelCipherValidity *camel_cipher_verify (CamelCipherContext *context, CamelCipherHash hash,
- struct _CamelStream *istream, struct _CamelMimePart *sigpart,
- CamelException *ex);
+CamelCipherValidity *camel_cipher_verify (CamelCipherContext *context, struct _CamelMimePart *ipart, CamelException *ex);
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);
+CamelCipherValidity *camel_cipher_decrypt (CamelCipherContext *context, struct _CamelMimePart *ipart, struct _CamelMimePart *opart,
+ CamelException *ex);
/* key/certificate routines */
int camel_cipher_import_keys (CamelCipherContext *context, struct _CamelStream *istream,
@@ -130,10 +153,11 @@ void camel_cipher_validity_set_valid (CamelCipherValidity *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_envelope(CamelCipherValidity *valid, CamelCipherValidity *outer);
void camel_cipher_validity_free (CamelCipherValidity *validity);
/* utility functions */
-int camel_cipher_canonical_to_stream(CamelMimePart *part, CamelStream *ostream);
+int camel_cipher_canonical_to_stream(CamelMimePart *part, guint32 flags, CamelStream *ostream);
#ifdef __cplusplus
}