From 986252ceaf4239d36294d90e75c6acd305e06dfa Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 20 Apr 2001 21:21:34 +0000 Subject: Implemented using the secmime.h convenience functions. (smime_clearsign): 2001-04-20 Jeffrey Stedfast * camel-smime-context.c (smime_sign): Implemented using the secmime.h convenience functions. (smime_clearsign): We just error our here, there is no clearsign for smime. (smime_verify): Copied code over from the pkcs7 verify - same state, ugly and unknown :-) (smime_encrypt): Implemented using the secmime.h convenience functions. (smime_decrypt): Same as the code in pkcs7-context. svn path=/trunk/; revision=9480 --- camel/camel-pkcs7-context.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'camel/camel-pkcs7-context.c') diff --git a/camel/camel-pkcs7-context.c b/camel/camel-pkcs7-context.c index 7d9091758a..fee277e079 100644 --- a/camel/camel-pkcs7-context.c +++ b/camel/camel-pkcs7-context.c @@ -412,18 +412,18 @@ pkcs7_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash ha #if 0 /* this is just meant as a reference so I can see what the valid enums are */ typedef enum { - certUsageSSLClient, - certUsageSSLServer, - certUsageSSLServerWithStepUp, - certUsageSSLCA, - certUsageEmailSigner, - certUsageEmailRecipient, - certUsageObjectSigner, - certUsageUserCertImport, - certUsageVerifyCA, - certUsageProtectedObjectSigner, - certUsageStatusResponder, - certUsageAnyCA + certUsageSSLClient, + certUsageSSLServer, + certUsageSSLServerWithStepUp, + certUsageSSLCA, + certUsageEmailSigner, + certUsageEmailRecipient, + certUsageObjectSigner, + certUsageUserCertImport, + certUsageVerifyCA, + certUsageProtectedObjectSigner, + certUsageStatusResponder, + certUsageAnyCA } SECCertUsage; #endif @@ -509,6 +509,9 @@ pkcs7_verify (CamelCipherContext *ctx, CamelCipherHash hash, CamelStream *istrea SEC_PKCS7DestroyContentInfo (cinfo); + /* FIXME: set a meaningful description...in UTF8 */ + camel_cipher_validity_set_description (valid, ""); + return valid; } @@ -549,9 +552,17 @@ pkcs7_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrA goto exception; } - cinfo = SEC_PKCS7CreateEnvelopedData (cert, certUsageEmailRecipient, - NULL, SEC_OID_DES_EDE3_CBC, 0, - NULL, NULL); + data = g_new (struct _GetPasswdData, 1); + data->session = session; + data->userid = userid; + data->ex = ex; + + /* FIXME: extend CamelCipherContext to allow selecting an encryption algorithm?? */ + cinfo = SEC_PKCS7CreateEncryptedData (SEC_OID_DES_EDE3_CBC, 0, + get_password, data); + + g_free (data); + if (!cinfo) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not encrypt: failed to create enveloped data.")); -- cgit v1.2.3