aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-smime-context.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-smime-context.c')
-rw-r--r--camel/camel-smime-context.c53
1 files changed, 29 insertions, 24 deletions
diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c
index 7d2814fb82..8f944841fe 100644
--- a/camel/camel-smime-context.c
+++ b/camel/camel-smime-context.c
@@ -32,9 +32,15 @@
#include "camel-stream-filter.h"
#include "camel-stream-fs.h"
#include "camel-stream-mem.h"
+#include "camel-mime-part.h"
+#include "camel-multipart.h"
#include "nss.h"
#include <cms.h>
+#include <cert.h>
+#include <certdb.h>
+#include <pkcs11.h>
+#include <smime.h>
#include <gtk/gtk.h> /* for _() macro */
@@ -64,7 +70,7 @@ static CamelMimeMessage *smime_envelope (CamelCMSContext *ctx, CamelMimeMessage
static CamelMimeMessage *smime_decode (CamelCMSContext *ctx, CamelMimeMessage *message,
CamelCMSValidityInfo **info, CamelException *ex);
-static CamelCipherContextClass *parent_class;
+static CamelCMSContextClass *parent_class;
static void
camel_smime_context_init (CamelSMimeContext *context)
@@ -89,11 +95,11 @@ camel_smime_context_class_init (CamelSMimeContextClass *camel_smime_context_clas
parent_class = CAMEL_CMS_CONTEXT_CLASS (camel_type_get_global_classfuncs (camel_cms_context_get_type ()));
- camel_cms_context_class->sign = cms_sign;
- camel_cms_context_class->certsonly = cms_certsonly;
- camel_cms_context_class->encrypt = cms_encrypt;
- camel_cms_context_class->envelope = cms_envelope;
- camel_cms_context_class->decode = cms_decode;
+ camel_cms_context_class->sign = smime_sign;
+ camel_cms_context_class->certsonly = smime_certsonly;
+ camel_cms_context_class->encrypt = smime_encrypt;
+ camel_cms_context_class->envelope = smime_envelope;
+ camel_cms_context_class->decode = smime_decode;
}
CamelType
@@ -198,7 +204,7 @@ signed_data (CamelSMimeContext *ctx, const char *userid, gboolean signing_time,
return NULL;
}
- if ((cert = CERT_FindCertByNickname (ctx->priv->certdb, userid)) == NULL) {
+ if ((cert = CERT_FindCertByNickname (ctx->priv->certdb, (char *) userid)) == NULL) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("The signature certificate for \"%s\" does not exist."),
userid);
@@ -386,17 +392,17 @@ smime_sign (CamelCMSContext *ctx, CamelMimeMessage *message,
static NSSCMSMessage *
-certsonly_data (CamelSMimeContext *ctx, const char *userid, GByteArray *recipients, CamelException *ex)
+certsonly_data (CamelSMimeContext *ctx, const char *userid, GPtrArray *recipients, CamelException *ex)
{
NSSCMSMessage *cmsg = NULL;
NSSCMSContentInfo *cinfo;
NSSCMSSignedData *sigd;
CERTCertificate **rcerts;
- int i;
+ int i = 0;
/* find the signer's and the recipients' certs */
rcerts = g_new (CERTCertificate *, recipients->len + 2);
- rcerts[0] = CERT_FindCertByNicknameOrEmailAddr (ctx->priv->certdb, userid);
+ rcerts[0] = CERT_FindCertByNicknameOrEmailAddr (ctx->priv->certdb, (char *) userid);
if (!rcerts[0]) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to find certificate for \"%s\"."),
@@ -424,7 +430,7 @@ certsonly_data (CamelSMimeContext *ctx, const char *userid, GByteArray *recipien
/* add the recipient cert chain */
for (i = 0; i < recipients->len; i++) {
- NSS_CMSSignedData_AddCertChain (sigd, certs[i]);
+ NSS_CMSSignedData_AddCertChain (sigd, rcerts[i]);
}
cinfo = NSS_CMSMessage_GetContentInfo (cmsg);
@@ -452,6 +458,7 @@ smime_certsonly (CamelCMSContext *ctx, CamelMimeMessage *message,
CamelException *ex)
{
CamelMimeMessage *mesg = NULL;
+ struct _GetPasswdData *data;
NSSCMSMessage *cmsg = NULL;
PLArenaPool *arena;
NSSCMSEncoderContext *ecx;
@@ -512,7 +519,7 @@ enveloped_data (CamelSMimeContext *ctx, const char *userid, GPtrArray *recipient
/* find the recipient certs by email address or nickname */
rcerts = g_new (CERTCertificate *, recipients->len + 2);
- rcerts[0] = CERT_FindCertByNicknameOrEmailAddr (ctx->priv->certdb, userid);
+ rcerts[0] = CERT_FindCertByNicknameOrEmailAddr (ctx->priv->certdb, (char *) userid);
if (!rcerts[0]) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to find certificate for \"%s\"."),
@@ -574,6 +581,7 @@ smime_envelope (CamelCMSContext *ctx, CamelMimeMessage *message,
CamelException *ex)
{
CamelMimeMessage *mesg = NULL;
+ struct _GetPasswdData *data;
NSSCMSMessage *cmsg = NULL;
PLArenaPool *arena;
NSSCMSEncoderContext *ecx;
@@ -622,8 +630,8 @@ smime_envelope (CamelCMSContext *ctx, CamelMimeMessage *message,
struct _BulkKey {
- PK11KeySym *bulkkey;
- SECOidTag bulkkeytag;
+ PK11SymKey *bulkkey;
+ SECOidTag bulkalgtag;
int keysize;
};
@@ -754,8 +762,8 @@ smime_encrypt (CamelCMSContext *ctx, CamelMimeMessage *message,
static NSSCMSMessage *
-decode (CamelSMimeContext *ctx, GByteArray *input, CamelStream *ostream,
- CamelCMSValidityInfo **info, CamelExcepton *ex)
+decode_data (CamelSMimeContext *ctx, GByteArray *input, CamelStream *ostream,
+ CamelCMSValidityInfo **info, CamelException *ex)
{
NSSCMSDecoderContext *dcx;
struct _GetPasswdData *data;
@@ -765,17 +773,14 @@ decode (CamelSMimeContext *ctx, GByteArray *input, CamelStream *ostream,
NSSCMSSignedData *sigd = NULL;
NSSCMSEnvelopedData *envd;
NSSCMSEncryptedData *encd;
- SECAlgorithmID **digestalgs;
int nlevels, i, nsigners, j;
char *signercn;
NSSCMSSignerInfo *si;
SECOidTag typetag;
- SECItem **digests;
- PLArenaPool *arena;
- SECItem *item, sitem = { 0, 0, 0 };
+ SECItem *item;
data = g_new (struct _GetPasswdData, 1);
- data->session = ctx->session;
+ data->session = CAMEL_CMS_CONTEXT (ctx)->session;
data->userid = NULL;
data->ex = ex;
@@ -783,7 +788,7 @@ decode (CamelSMimeContext *ctx, GByteArray *input, CamelStream *ostream,
NULL, NULL,
smime_get_password, data,
decode_key_cb,
- decodeOptions->bulkkey);
+ NULL);
NSS_CMSDecoder_Update (dcx, input->data, input->len);
@@ -861,7 +866,7 @@ decode (CamelSMimeContext *ctx, GByteArray *input, CamelStream *ostream,
certUsageEmailSigner);
if (signers) {
- signers->signeercn = g_strdup (signercn);
+ signers->signercn = g_strdup (signercn);
signers->status = g_strdup (
NSS_CMSUtil_VerificationStatusToString (
NSS_CMSSignerInfo_GetVerificationStatus (si)));
@@ -918,7 +923,7 @@ smime_decode (CamelCMSContext *ctx, CamelMimeMessage *message,
buf = CAMEL_STREAM_MEM (stream)->buffer;
ostream = camel_stream_mem_new ();
- cmsg = decode (CAMEL_SMIME_CONTEXT (ctx), buf, ostream, info, ex);
+ cmsg = decode_data (CAMEL_SMIME_CONTEXT (ctx), buf, ostream, info, ex);
camel_object_unref (CAMEL_OBJECT (stream));
if (!cmsg) {
camel_object_unref (CAMEL_OBJECT (ostream));
an>/+11 | * - Update to 0.5.2danilo2019-09-082-7/+7 | * sysutils/cmdwatch: Set LICENSE0mp2019-09-081-0/+2 | * Mark BROKENantoine2019-09-081-0/+2 | * Mark BROKENantoine2019-09-081-0/+1 | * Mark BROKENantoine2019-09-081-0/+2 | * Mark BROKENantoine2019-09-081-0/+2 | * Mark as deprecated some azure-cli dependenciesdbaio2019-09-0851-0/+153 | * sysutils/py-azure-cli: Update to 2.0.72dbaio2019-09-085-61/+139 | * sysutils/py-azure-cli-core: Update to 2.0.72dbaio2019-09-082-12/+7 | * sysutils/py-azure-cli-telemetry: Update to 1.0.3dbaio2019-09-082-5/+5 | * Allow building backuppc* ports together.mandree2019-09-082-5/+6 | * sysutils/fusefs-exfat, sysutils/exfat-utils: Update to 1.3.0mandree2019-09-088-384/+10 | * Remove libXxf86misc dependency from gnome@ portszeising2019-09-073-6/+7 | * devel/py-fabric: Copy to devel/py-fabric1dbaio2019-09-072-5/+10 * | Merge remote-tracking branch 'upstream/master'Koop Mast2019-09-07228-4460/+1450 |\| | * - Update to 0.3.1ak2019-09-072-9/+15 | * update sysutils/terraform to 0.12.8 and unbreak with go1.13lifanov2019-09-062-7/+5 | * update sysutils/packer to 1.4.3 and unbreak with go1.13lifanov2019-09-062-7/+5 | * - cease hosting distfilesjgh2019-09-061-2/+2 | * KDE Applications: update to 19.08.1tcberner2019-09-0614-40/+40 | * sysutils/p5-Filesys-DiskUsage: update to 0.13culot2019-09-052-4/+4 | * Remove expired ports:rene2019-09-0518-394/+0 | * - Update WWWamdmi32019-09-052-2/+2 | * - Update to 0.5.0danilo2019-09-052-7/+7 | * sysutils/zrep: upgrade 1.7.6 -> 1.7.7pi2019-09-052-4/+4 | * - Update to 20190808kmoore2019-09-044-12/+11 | * sysutils/doctl: Update to v1.30.0jrm2019-09-042-4/+4 | * Remove unsupported versions from sysutils/syslog-ngrene2019-09-041-1/+1 | * Remove expired ports:rene2019-09-0443-4129/+0 | * sysutils/synergy-1: Update 1.10.2 -> 1.10.3yuri2019-09-042-6/+5 | * Update to the latest cfengine commit on github.cy2019-09-042-8/+8 | * - Update to 0.4.3danilo2019-09-042-84/+125 | * - Set deprecated / expiration on sysadm ports, no longer maintainedkmoore2019-09-042-0/+6 | * - Mark deprecated and set expiration datekmoore2019-09-041-0/+3 | * Update version requirement of RUN_DEPENDSsunpoet2019-09-041-5/+6 | * Update version requirement of RUN_DEPENDSsunpoet2019-09-041-4/+5 | * Update version requirement of RUN_DEPENDSsunpoet2019-09-041-6/+7 | * Cosmetic changesunpoet2019-09-041-2/+3 | * Update to 2.15.1sunpoet2019-09-042-11/+12 | * KDE Plasma Desktop -- update to 5.16.5tcberner2019-09-0420-34/+49 | * Accelerate the expiry date of already deprecated syslog-ng ports.cy2019-09-035-5/+5 | * Thank you to Peter Czanik, of Balabit the producers of syslog-ng, forcy2019-09-0310-1/+922 | * - Switch to USES=go:modules, fix build with go1.13 [1]danilo2019-09-033-166/+259 | * - Switch to USES=go:modules, fix build with go1.13 [1]danilo2019-09-032-7/+6 | * - Update to 1.15.3danilo2019-09-032-4/+4 | * sysutils/reggae: update to 0.1.6swills2019-09-033-4/+9 | * Update to 12.5.4sunpoet2019-09-032-4/+4 | * sysutils/tuptime: update to 4.0.0swills2019-09-035-9/+13 | * sysutils/flashrom: update to 1.1swills2019-09-033-34/+5 | * sysutils/paladin: update to 2.0.1swills2019-09-032-4/+4 | * sysutils/ctop: Switch to USES=go:modules, fix build with go1.13swills2019-09-031-3/+1 | * sysutils/ttyd: update to 1.5.2swills2019-09-032-4/+4 | * sysutils/rundeck: update to 2.11.13swills2019-09-032-4/+4 | * actually connect iocswills2019-09-021-0/+1 | * sysutils/ioc: create portswills2019-09-025-0/+140 | * sysutils/py-pyznap: Update to 1.4.2swills2019-09-022-4/+4 | * - Update to 0.21.0araujo2019-09-022-5/+4 | * Unbreak sysutils/pc-networkmanageradridg2019-09-022-4/+17 | * sysutils/uptimed: update to 0.4.2, change maintainer, pet portlintpkubaj2019-09-022-8/+8 | * graphics/poppler: update to 0.80.0tcberner2019-09-022-2/+2 | * Fix document generation.madpilot2019-09-022-11/+9 | * Add sysutils/ufetchdbaio2019-09-024-0/+38 | * Mark DEPRECATED.ehaupt2019-09-011-0/+6 | * devel/libfmt: Update to 6.0.0tobik2019-09-011-1/+1 | * sysutils/byobu: Better sed fixyuri2019-09-011-4/+3 | * sysutils/frand: Canonicalize USE_GITHUB usagetobik2019-09-011-4/+1 | * sysutils/linux-rkbin: Spell ONLY_FOR_ARCHS correctlytobik2019-08-311-1/+1 | * - adjust sed to conform to BSD usagejgh2019-08-311-1/+3 | * - adopt options framework for post-install targetjgh2019-08-311-0/+2 | * - remove unnecessary dependenciesjgh2019-08-311-1/+1 | * Update to the latest cfengine github commit.cy2019-08-312-5/+5 | * Update to the latest cfengine commit on github. This includescy2019-08-312-9/+12 | * sysutils/doctl: Update to v1.29.2jrm2019-08-312-4/+4 | * unbreak vagrant after ports r510245cmt2019-08-302-2/+4 | * Update to 0.9.39ehaupt2019-08-302-4/+4 | * Update to 1.18sunpoet2019-08-303-5/+5 | * sysutils/vmdktool: Set TEST_TARGET and WWW, and fix ALL_TARGET0mp2019-08-292-0/+9 | * Always install the manpage and let the user decide if they do wantbapt2019-08-292-11/+4 | * Builds fine with llvm again.cy2019-08-291-2/+0 | * Remove extraneous MASTER_SITES.cy2019-08-292-2/+0 | * sysutils/byobu: Update WWWlme2019-08-291-1/+1 | * Remove building man page by default. It's currently broken on HEADkrion2019-08-291-2/+2 | * sysutils/polkit-qt: fix pkg-nametcberner2019-08-291-2/+1 | * sysutils/node_exporter: Switch to USES=go:modules, fix build with go1.13yuri2019-08-291-5/+1 | * - update to 5.129jgh2019-08-293-6/+17 | * sysutils/polkit-qt-1: update to 0.113.0tcberner2019-08-295-55/+51 | * Update to 6.8.1romain2019-08-292-4/+4 | * - Simplify the port moving out unneeded post-extract, do-build andaraujo2019-08-281-9/+3 | * Update to 2.3.0romain2019-08-282-5/+4 | * - adjust PLIST to standardsjgh2019-08-281-1/+2 | * sysutils/nomad: update to 0.9.5jhixson2019-08-282-5/+4 | * Update to 1.4.0romain2019-08-282-4/+4 | * A personal terminal-based dashboard utility, designed for displayingaraujo2019-08-275-0/+282 | * sysutils/doctl: Update to v1.28.0 and use Go Modules [1]jrm2019-08-272-7/+6 | * Upgrade to 0.0.17dvl2019-08-262-4/+4 | * sysutils/py-pkginfo: Update to 1.5.0.1kai2019-08-262-5/+5 | * Update to 0.0.16dvl2019-08-262-5/+4 | * acts: Update to 1.4.1adamw2019-08-265-40/+14 | * Add devel/git-lite as missing RUN_DEPENDSdvl2019-08-251-1/+3 | * sysutils/testdisk: Update to 7.1 and unbreakkai2019-08-252-6/+5 | * - Mark BROKEN on 13.xamdmi32019-08-251-0/+4 | * sysutils/py-mitogen: update to 0.2.8 to support latest ansibledch2019-08-252-4/+4 * | Merge remote-tracking branch 'upstream/master'Koop Mast2019-08-24149-3269/+1509 |\| | * Add new port sysutils/terraform-provider-vultrwoodsb022019-08-244-0/+37 | * Cosmetic changesunpoet2019-08-241-2/+3 | * Update to 1.6.4sunpoet2019-08-243-6/+5 | * Update to 3.14.3romain2019-08-232-5/+4 | * - Use upstream patches.jkim2019-08-234-4/+16 | * - set deprecation on obsolete technologyjgh2019-08-222-0/+6 | * Update to 1.4.0romain2019-08-222-4/+6 | * Update to 6.8.0romain2019-08-222-4/+4 | * Update to 8.1908.0matthew2019-08-222-5/+4 | * Update to 3.3.1romain2019-08-212-4/+4 | * sysutils/pot: Update to 0.9.1pizzamig2019-08-212-5/+6 | * Update to 12.5.3sunpoet2019-08-212-4/+4 | * - shift to more applicable categoryjgh2019-08-215-0/+57 | * - chase 509434jgh2019-08-211-0/+1 | * - shift bibelot to more applicable categoryjgh2019-08-213-0/+32 | * Update to 12.5.1sunpoet2019-08-203-4/+6 | * devel/boost-*: update to 1.71.0jbeich2019-08-1913-10/+13 | * Pass -no-daemon to gradle more directly.cy2019-08-1913-0/+39 | * Some @comment $FreeBSD$ always creep back, for some reason.mat2019-08-192-2/+0 | * Revert r509253. The suggested solution does not work after all incy2019-08-1913-52/+0 | * Address left over gradle daemons under poudriere when JAVA optionscy2019-08-1913-0/+52 | * Update sysutils/virtualmin to version 6.07.olgeni2019-08-193-4/+5 | * Update sysutils/usermin to version 1.780.olgeni2019-08-193-30/+214 | * Update sysutils/webmin to version 1.930.olgeni2019-08-193-787/+850 | * - Fix build under i386zi2019-08-191-4/+5 | * Add new port sysutils/frandrodrigo2019-08-185-0/+38 | * Remove expired port:rene2019-08-1818-2290/+0 | * sysutils/desktop-installer: Upgrade to 0.6.7jwb2019-08-172-4/+4 | * - Pet portlintamdmi32019-08-173-5/+7 | * sysutils/snmp_exporter: Switch to USES=go:modules, fix build with go1.13yuri2019-08-171-10/+4 | * syslog-ng family of ports: JAVA_MOD implies JAVA.cy2019-08-1713-0/+13 | * syslog-ng322 is now default.cy2019-08-171-1/+1 | * - chase 509083jgh2019-08-171-0/+1 | * Update to 20190816.jkim2019-08-174-6/+37 | * - Add screeenfetch-nox11, which is an x11-disabled slave port ofjgh2019-08-161-0/+12 | * - add x11 to option setjgh2019-08-161-3/+6 | * sysutils/fusefs-smbnetfs: fix build with GCC-based architecturespkubaj2019-08-161-1/+1 | * sysutils/docker-credential-pass: Update to 0.6.3yuri2019-08-162-6/+6 | * - Add new fpc bootstrap (i386 and x86_64). It could need less COMPATXacm2019-08-163-3/+0 | * Update KDE Applications to latest upstream release, 19.08adridg2019-08-1537-60/+61 | * lang/rust: Update to 1.37.0tobik2019-08-156-5/+6 * | Merge remote-tracking branch 'upstream/master'Koop Mast2019-08-15324-4502/+2030 |\| | * Update KDE Frameworks to latest upstream release, 5.61adridg2019-08-155-9/+6 | * - Add LICENSE_FILEamdmi32019-08-152-1/+2 | * Fix two mismatches between function declaration and definition.cy2019-08-153-1/+27 | * Update conky to 1.11.5madpilot2019-08-152-5/+4 | * Update to 12.4sunpoet2019-08-152-4/+4 | * New port: sysutils/sensu-go:zi2019-08-159-0/+291 | * Update to 12.0.14krion2019-08-142-4/+4 | * Convert to UCL & cleanup pkg-message (categories s)mat2019-08-14226-636/+1461 | * pkg-message UCL triggers only work on one type at a time.rene2019-08-141-1/+1 | * Implement new virtual category: net-vpn for VPN related portsmeta2019-08-141-1/+1 | * sysutils/potnet: update to 0.3.2pizzamig2019-08-142-37/+100 | * Fix RUN_DEPENDSsunpoet2019-08-141-3/+4 | * sysutils/cluster-glue: fix after r508756rene2019-08-141-2/+0 | * xen-{tools/kernel}: update to 4.12.1royger2019-08-1313-1377/+5 | * sysuilts/pot: Update to 0.9.0pizzamig2019-08-134-8/+14 | * Remove expired port:rene2019-08-1310-2270/+0 | * sysutils/cluster-glue: remove support for expired sysutils/openhpirene2019-08-131-6/+3 | * sysutils/potnet: Update to 0.3.1pizzamig2019-08-132-4/+4 | * sysutils/yank: Update to 1.2.0tobik2019-08-122-4/+4 | * Update to the latest cfengine gitub commit.cy2019-08-122-5/+5 | * update sysutils/debootstrap to 1.0.115lifanov2019-08-123-5/+6 | * update sysutils/terraform to 0.12.6lifanov2019-08-122-4/+4 | * update sysutils/ansible to 2.8.3lifanov2019-08-122-4/+4 | * sysutils/crate: Update 0.1.2 -> 0.1.3yuri2019-08-112-4/+4 | * sysutils/lsof: fix build on -current, fix man pageler2019-08-112-2/+14 | * Upgrade to 20190810dvl2019-08-113-53/+6 | * sysutils/crate: Update 0.1.1 -> 0.1.2yuri2019-08-112-4/+4 | * sysutils/burp-devel: Update to 2.3.12kai2019-08-102-4/+4 | * sysutils/barrier: Update to v2.3.1tobik2019-08-102-5/+4 | * - update to commit b51393ejgh2019-08-102-4/+5 | * sysutils/mtm: Fix building on 11.2 amd640mp2019-08-101-1/+1 | * sysutils/crate: Improve the BROKEN statements; Add emulators to CATEGORIESyuri2019-08-101-4/+3 | * sysutils/doctl: Update to version 1.27.0jrm2019-08-092-4/+4 | * Upgrade to 0.0.15dvl2019-08-093-4/+6 | * sysutils/crate: Fix the accidentally changed BROKEN statement.yuri2019-08-091-1/+1 | * sysutils/crate: Update 0.1 -> 0.1.1yuri2019-08-093-8/+8 | * - reclaimjgh2019-08-083-3/+3 | * - Update to 20190611zi2019-08-082-4/+4 | * sysutils/rubygem-tmuxinator: Update to 1.1.1meta2019-08-082-6/+5 | * Update to 12.3sunpoet2019-08-082-4/+4 | * - update to 20190725jgh2019-08-072-7/+8 | * - remove unnecessary usage of MASTER_SITESjgh2019-08-071-2/+1 | * Updated to v164ultima2019-08-072-4/+4 | * sysutils/mtm: Fix a typo in COMMENT0mp2019-08-071-1/+1