[gmime] added pkcs7 cipher context to the build
- From: Jeffrey Stedfast <fejj src gnome org>
- To: svn-commits-list gnome org
- Subject: [gmime] added pkcs7 cipher context to the build
- Date: Sat, 4 Jul 2009 20:33:29 +0000 (UTC)
commit a05c0f6428486c657bf36837e4ba643fa255dac0
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sat Jul 4 16:32:39 2009 -0400
added pkcs7 cipher context to the build
2009-07-04 Jeffrey Stedfast <fejj novell com>
* configure.ac: Check for GpgME needed for S/MIME support.
* gmime/Makefile.am: Include gmime-pkcs7-context.[c,h] in the
build.
ChangeLog | 5 ++
configure.ac | 26 +++++++++---
gmime/Makefile.am | 2 +
gmime/gmime-cipher-context.c | 12 +++---
gmime/gmime-cipher-context.h | 14 +++----
gmime/gmime-error.h | 13 +++++-
gmime/gmime-pkcs7-context.c | 90 +++++++++++++++++++++++------------------
gmime/gmime-pkcs7-context.h | 1 -
gmime/gmime.c | 2 +
tests/test-pgpmime.c | 2 -
10 files changed, 101 insertions(+), 66 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d3e03a1..bf53f09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-07-04 Jeffrey Stedfast <fejj novell com>
+ * configure.ac: Check for GpgME needed for S/MIME support.
+
+ * gmime/Makefile.am: Include gmime-pkcs7-context.[c,h] in the
+ build.
+
* gmime/gmime-pkcs7-context.[c,h]: New source files implementing
the pkcs7 cipher context using GpgMe.
diff --git a/configure.ac b/configure.ac
index b307f43..f6d5344 100644
--- a/configure.ac
+++ b/configure.ac
@@ -422,29 +422,29 @@ if test "x$enable_largefile" != "xno"; then
enable_largefile="no"
if test "x$ac_cv_largefile64_source" = "xyes"; then
- GMIME_CFLAGS="-D_LARGEFILE64_SOURCE"
+ LFS_CFLAGS="-D_LARGEFILE64_SOURCE"
enable_largefile="yes"
elif test "x$ac_cv_largefile64_source" = "xunknown"; then
AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
fi
if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
- GMIME_CFLAGS="$GMIME_CFLAGS -D_LARGE_FILES"
+ LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
enable_largefile="yes"
fi
if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
- GMIME_CFLAGS="$GMIME_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
+ LFS_CFLAGS="$LFS_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
enable_largefile="yes"
fi
else
- GMIME_CFLAGS=""
+ LFS_CFLAGS=""
fi
AM_CONDITIONAL(ENABLE_LARGEFILE, test "x$enable_largefile" = "xyes")
dnl Check type sizes
CFLAGS_save="$CFLAGS"
-CFLAGS="$CFLAGS $GMIME_CFLAGS"
+CFLAGS="$CFLAGS $LFS_CFLAGS"
AC_CHECK_SIZEOF(ssize_t)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(off_t)
@@ -465,6 +465,12 @@ dnl *************************
LIBNSL=""
AC_CHECK_LIB(nsl, getaddrinfo, LIBNSL="-lnsl")
+dnl ******************************************
+dnl *** Checks for GpgME needed for S/MIME ***
+dnl ******************************************
+AM_PATH_GPGME_PTHREAD(1.1.6, enable_smime="yes (via GpgME)", enable_smime="no")
+
+
dnl ****************************
dnl *** Enable Mono bindings ***
dnl ****************************
@@ -552,12 +558,16 @@ fi
if test "x$LIBICONV" != "x"; then
EXTRA_LIBS="$EXTRA_LIBS $LIBICONV"
fi
-
-AC_SUBST(CFLAGS)
+if test "x$GPGME_PTHREAD_LIBS" != "x"; then
+ EXTRA_LIBS="$EXTRA_LIBS $GPGME_PTHREAD_LIBS"
+fi
LIBS="$LIBS $EXTRA_LIBS"
+
+AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
+GMIME_CFLAGS="$LFS_CFLAGS $GPGME_PTHREAD_CFLAGS"
GMIME_LIBDIR="-L${libdir}"
GMIME_INCLUDEDIR="-I${includedir}/gmime-2.6"
GMIME_LIBS="-lgmime-2.6 $EXTRA_LIBS"
@@ -603,6 +613,8 @@ Configuration:
Large file support: ${enable_largefile}
Console warnings: ${enable_warnings}
+ PGP/MIME support: yes
+ S/MIME support: ${enable_smime}
Mono bindings: ${enable_mono}
"
diff --git a/gmime/Makefile.am b/gmime/Makefile.am
index a944d33..a7ed379 100644
--- a/gmime/Makefile.am
+++ b/gmime/Makefile.am
@@ -56,6 +56,7 @@ libgmime_2_6_la_SOURCES = \
gmime-parse-utils.c \
gmime-parser.c \
gmime-part.c \
+ gmime-pkcs7-context.c \
gmime-stream.c \
gmime-stream-buffer.c \
gmime-stream-cat.c \
@@ -106,6 +107,7 @@ gmimeinclude_HEADERS = \
gmime-param.h \
gmime-parser.h \
gmime-part.h \
+ gmime-pkcs7-context.h \
gmime-stream.h \
gmime-stream-buffer.h \
gmime-stream-cat.h \
diff --git a/gmime/gmime-cipher-context.c b/gmime/gmime-cipher-context.c
index 68d04e1..7c5f352 100644
--- a/gmime/gmime-cipher-context.c
+++ b/gmime/gmime-cipher-context.c
@@ -221,7 +221,7 @@ static int
cipher_sign (GMimeCipherContext *ctx, const char *userid, GMimeCipherHash hash,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"Signing is not supported by this cipher");
return -1;
@@ -258,7 +258,7 @@ static GMimeSignatureValidity *
cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash, GMimeStream *istream,
GMimeStream *sigstream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"Verifying is not supported by this cipher");
return NULL;
@@ -297,7 +297,7 @@ static int
cipher_encrypt (GMimeCipherContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"Encryption is not supported by this cipher");
return -1;
@@ -335,7 +335,7 @@ static GMimeSignatureValidity *
cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"Decryption is not supported by this cipher");
return NULL;
@@ -378,7 +378,7 @@ g_mime_cipher_context_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
static int
cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"You may not import keys with this cipher");
return -1;
@@ -410,7 +410,7 @@ static int
cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err)
{
- g_set_error (err, GMIME_ERROR_QUARK, GMIME_ERROR_NOT_SUPPORTED,
+ g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"You may not export keys with this cipher");
return -1;
diff --git a/gmime/gmime-cipher-context.h b/gmime/gmime-cipher-context.h
index d609404..44ec3ce 100644
--- a/gmime/gmime-cipher-context.h
+++ b/gmime/gmime-cipher-context.h
@@ -225,7 +225,6 @@ typedef enum {
* GMimeSignerError:
* @GMIME_SIGNER_ERROR_NONE: No error.
* @GMIME_SIGNER_ERROR_EXPSIG: Expired signature.
- * @GMIME_SIGNER_ERROR_REVSIG: Revoked signature.
* @GMIME_SIGNER_ERROR_NO_PUBKEY: No public key found.
* @GMIME_SIGNER_ERROR_EXPKEYSIG: Expired signature key.
* @GMIME_SIGNER_ERROR_REVKEYSIG: Revoked signature key.
@@ -234,11 +233,10 @@ typedef enum {
**/
typedef enum {
GMIME_SIGNER_ERROR_NONE,
- GMIME_SIGNER_ERROR_EXPSIG = (1 << 0), /* expire signature */
- GMIME_SIGNER_ERROR_REVSIG = (1 << 1), /* revoked signature */
- GMIME_SIGNER_ERROR_NO_PUBKEY = (1 << 2), /* no public key */
- GMIME_SIGNER_ERROR_EXPKEYSIG = (1 << 3), /* expired key */
- GMIME_SIGNER_ERROR_REVKEYSIG = (1 << 4) /* revoked key */
+ GMIME_SIGNER_ERROR_EXPSIG = (1 << 0), /* expired signature */
+ GMIME_SIGNER_ERROR_NO_PUBKEY = (1 << 1), /* no public key */
+ GMIME_SIGNER_ERROR_EXPKEYSIG = (1 << 2), /* expired key */
+ GMIME_SIGNER_ERROR_REVKEYSIG = (1 << 3) /* revoked key */
} GMimeSignerError;
@@ -265,9 +263,9 @@ typedef enum {
struct _GMimeSigner {
GMimeSigner *next;
unsigned int status:2; /* GMimeSignerStatus */
- unsigned int errors:5; /* bitfield of GMimeSignerError's */
+ unsigned int errors:4; /* bitfield of GMimeSignerError's */
unsigned int trust:3; /* GMimeSignerTrust */
- unsigned int unused:22; /* unused expansion bits */
+ unsigned int unused:21; /* unused expansion bits */
char *issuer_serial;
char *issuer_name;
char *fingerprint;
diff --git a/gmime/gmime-error.h b/gmime/gmime-error.h
index f6b24d6..cf10d69 100644
--- a/gmime/gmime-error.h
+++ b/gmime/gmime-error.h
@@ -27,14 +27,13 @@
G_BEGIN_DECLS
extern GQuark gmime_error_quark;
-#define GMIME_ERROR_QUARK gmime_error_quark
/**
* GMIME_ERROR:
*
* The GMime error domain GQuark value.
**/
-#define GMIME_ERROR GMIME_ERROR_QUARK
+#define GMIME_ERROR gmime_error_quark
/**
* GMIME_ERROR_IS_SYSTEM:
@@ -57,6 +56,16 @@ enum {
GMIME_ERROR_NO_VALID_RECIPIENTS = -5
};
+
+extern GQuark gmime_gpgme_error_quark;
+
+/**
+ * GMIME_GPGME_ERROR:
+ *
+ * The GMime GpgMe error domain GQuark value.
+ **/
+#define GMIME_GPGME_ERROR gmime_gpgme_error_quark
+
G_END_DECLS
#endif /* __GMIME_ERROR_H__ */
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index 6004a5f..399f0e1 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -62,7 +62,6 @@ typedef struct _GMimePkcs7ContextPrivate {
gpgme_ctx_t ctx;
} Pkcs7Ctx;
-
static void g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass);
static void g_mime_pkcs7_context_init (GMimePkcs7Context *ctx, GMimePkcs7ContextClass *klass);
static void g_mime_pkcs7_context_finalize (GObject *object);
@@ -293,9 +292,10 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
gpgme_subkey_t subkey;
gboolean bad = FALSE;
gpgme_error_t error;
+ int errval = 0;
- if ((error = gpg_op_keylist_start (pkcs7->ctx, name, secret)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
+ if ((error = gpgme_op_keylist_start (pkcs7->ctx, name, secret)) != GPG_ERR_NO_ERROR) {
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
return NULL;
}
@@ -311,8 +311,19 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
if (subkey && KEY_IS_OK (subkey) &&
(subkey->expires == 0 || subkey->expires > now))
break;
+
+ if (subkey->expired)
+ errval = GPG_ERR_KEY_EXPIRED;
+ else
+ errval = GPG_ERR_BAD_KEY;
+ } else {
+ if (key->expired)
+ errval = GPG_ERR_KEY_EXPIRED;
+ else
+ errval = GPG_ERR_BAD_KEY;
}
+ gpgme_key_unref (key);
bad = TRUE;
key = NULL;
}
@@ -320,26 +331,26 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
gpgme_op_keylist_end (pkcs7->ctx);
if (error != GPG_ERR_NO_ERROR && error != GPG_ERR_EOF) {
- g_set_error (err, GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not list keys for \"%s\""), name);
return NULL;
}
if (!key) {
if (strchr (name, '@')) {
if (bad)
- g_set_error (err, GPGME_ERROR, GPG_ERR_KEY_SELECTION,
+ g_set_error (err, GMIME_GPGME_ERROR, errval,
_("A key for %s is present, but it is expired, disabled, revoked or invalid"),
name);
else
- g_set_error (err, GPGME_ERROR, GPG_ERR_KEY_SELECTION,
+ g_set_error (err, GMIME_GPGME_ERROR, GPG_ERR_NOT_FOUND,
_("Could not find a key for %s"), name);
} else {
if (bad)
- g_set_error (err, GPGME_ERROR, GPG_ERR_KEY_SELECTION,
+ g_set_error (err, GMIME_GPGME_ERROR, errval,
_("A key with id %s is present, but it is expired, disabled, revoked or invalid"),
name);
else
- g_set_error (err, GPGME_ERROR, GPG_ERR_KEY_SELECTION,
+ g_set_error (err, GMIME_GPGME_ERROR, GPG_ERR_NOT_FOUND,
_("Could not find a key with id %s"), name);
}
@@ -354,7 +365,7 @@ pkcs7_add_signer (Pkcs7Ctx *pkcs7, const char *signer, GError **err)
{
gpgme_key_t key = NULL;
- if (!(key = pkcs7_get_key_by_name (ctx, signer, TRUE, err)))
+ if (!(key = pkcs7_get_key_by_name (pkcs7, signer, TRUE, err)))
return FALSE;
/* set the key (the previous operation guaranteed that it exists, no need
@@ -381,19 +392,19 @@ pkcs7_sign (GMimeCipherContext *context, const char *userid, GMimeCipherHash has
gpgme_set_armor (pkcs7->ctx, FALSE);
if ((error = gpgme_data_new_from_cbs (&input, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open input stream"));
return -1;
}
if ((error = gpgme_data_new_from_cbs (&output, &pkcs7_stream_funcs, ostream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open output stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open output stream"));
gpgme_data_release (input);
return -1;
}
/* sign the input stream */
- if ((error = gpgme_op_sign (pkcs7->ctx, input, output, GPG_SIG_MODE_DETACHED)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Signing failed"));
+ if ((error = gpgme_op_sign (pkcs7->ctx, input, output, GPGME_SIG_MODE_DETACH)) != GPG_ERR_NO_ERROR) {
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Signing failed"));
gpgme_data_release (output);
gpgme_data_release (input);
return -1;
@@ -428,7 +439,7 @@ pkcs7_trust (gpgme_validity_t trust)
}
static GMimeSignatureValidity *
-pkcs7_get_validity (Pkcs7Context *pkcs7, gboolean verify)
+pkcs7_get_validity (Pkcs7Ctx *pkcs7, gboolean verify)
{
GMimeSignatureStatus status = GMIME_SIGNATURE_STATUS_GOOD;
GMimeSignatureValidity *validity;
@@ -436,7 +447,7 @@ pkcs7_get_validity (Pkcs7Context *pkcs7, gboolean verify)
gpgme_verify_result_t result;
GMimeSignerError errors;
gpgme_subkey_t subkey;
- gpgme_key_sig_t sig;
+ gpgme_signature_t sig;
gpgme_user_id_t uid;
gpgme_key_t key;
@@ -460,19 +471,15 @@ pkcs7_get_validity (Pkcs7Context *pkcs7, gboolean verify)
signers->next = signer;
signers = signer;
- g_mime_signer_set_fingerprint (signer, sig->fpr);
+ g_mime_signer_set_sig_expires (signer, sig->exp_timestamp);
g_mime_signer_set_sig_created (signer, sig->timestamp);
- g_mime_signer_set_sig_expires (signer, sig->expires);
- g_mime_signer_set_key_id (signer, sig->keyid);
+ g_mime_signer_set_fingerprint (signer, sig->fpr);
- errors = GMimeSignerErrorNone;
+ errors = GMIME_SIGNER_ERROR_NONE;
- if (sig->expired)
+ if (sig->exp_timestamp != 0 && sig->exp_timestamp >= time (NULL))
errors |= GMIME_SIGNER_ERROR_EXPSIG;
- if (sig->revoked)
- errors |= GMIME_SIGNER_ERROR_REVSIG;
-
if (gpgme_get_key (pkcs7->ctx, sig->fpr, &key, 0) == GPG_ERR_NO_ERROR && key) {
/* get more signer info from their signing key */
g_mime_signer_set_trust (signer, pkcs7_trust (key->owner_trust));
@@ -488,7 +495,10 @@ pkcs7_get_validity (Pkcs7Context *pkcs7, gboolean verify)
if (uid->email && *uid->email)
g_mime_signer_set_email (signer, uid->email);
- if (signer->name && signer->email)
+ if (uid->uid && *uid->uid)
+ g_mime_signer_set_key_id (signer, uid->uid);
+
+ if (signer->name && signer->email && signer->keyid)
break;
uid = uid->next;
@@ -556,14 +566,14 @@ pkcs7_verify (GMimeCipherContext *context, GMimeCipherHash hash,
gpgme_error_t error;
if ((error = gpgme_data_new_from_cbs (&message, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open input stream"));
return NULL;
}
/* if @sigstream is non-NULL, then it is a detached signature */
if (sigstream != NULL) {
if ((error = gpgme_data_new_from_cbs (&signature, &pkcs7_stream_funcs, sigstream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open signature stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open signature stream"));
gpgme_data_release (message);
return NULL;
}
@@ -572,7 +582,7 @@ pkcs7_verify (GMimeCipherContext *context, GMimeCipherHash hash,
}
if ((error = gpgme_op_verify (pkcs7->ctx, signature, message, NULL)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not verify pkcs7 signature"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not verify pkcs7 signature"));
if (signature)
gpgme_data_release (signature);
gpgme_data_release (message);
@@ -633,15 +643,15 @@ pkcs7_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
}
if ((error = gpgme_data_new_from_cbs (&input, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
- key_list_free (rcpt);
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open input stream"));
+ key_list_free (rcpts);
return -1;
}
if ((error = gpgme_data_new_from_cbs (&output, &pkcs7_stream_funcs, ostream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open output stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open output stream"));
gpgme_data_release (input);
- key_list_free (rcpt);
+ key_list_free (rcpts);
return -1;
}
@@ -652,7 +662,7 @@ pkcs7_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
key_list_free (rcpts);
if (error != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Encryption failed"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Encryption failed"));
return -1;
}
@@ -670,19 +680,19 @@ pkcs7_decrypt (GMimeCipherContext *context, GMimeStream *istream,
gpgme_error_t error;
if ((error = gpgme_data_new_from_cbs (&input, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open input stream"));
return NULL;
}
if ((error = gpgme_data_new_from_cbs (&output, &pkcs7_stream_funcs, ostream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open output stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open output stream"));
gpgme_data_release (input);
return NULL;
}
/* decrypt the input stream */
if ((error = gpgme_op_decrypt_verify (pkcs7->ctx, input, output)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Decryption failed"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Decryption failed"));
gpgme_data_release (output);
gpgme_data_release (input);
return NULL;
@@ -704,13 +714,13 @@ pkcs7_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **e
gpgme_error_t error;
if ((error = gpgme_data_new_from_cbs (&keydata, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open input stream"));
return -1;
}
/* import the key(s) */
if ((error = gpgme_op_import (pkcs7->ctx, keydata)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not import key data"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not import key data"));
gpgme_data_release (keydata);
return -1;
}
@@ -729,15 +739,15 @@ pkcs7_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *os
gpgme_error_t error;
guint i;
- if ((error = gpgme_data_new_from_cbs (&keydata, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not open input stream"));
+ if ((error = gpgme_data_new_from_cbs (&keydata, &pkcs7_stream_funcs, ostream)) != GPG_ERR_NO_ERROR) {
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not open output stream"));
return -1;
}
/* export the key(s) */
for (i = 0; i < keys->len; i++) {
if ((error = gpgme_op_export (pkcs7->ctx, keys->pdata[i], 0, keydata)) != GPG_ERR_NO_ERROR) {
- g_set_error (err, GPGME_ERROR, error, _("Could not export key data"));
+ g_set_error (err, GMIME_GPGME_ERROR, error, _("Could not export key data"));
gpgme_data_release (keydata);
return -1;
}
diff --git a/gmime/gmime-pkcs7-context.h b/gmime/gmime-pkcs7-context.h
index 79b585e..1b44983 100644
--- a/gmime/gmime-pkcs7-context.h
+++ b/gmime/gmime-pkcs7-context.h
@@ -58,7 +58,6 @@ struct _GMimePkcs7ContextClass {
GType g_mime_pkcs7_context_get_type (void);
-
GMimeCipherContext *g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd);
gboolean g_mime_pkcs7_context_get_always_trust (GMimePkcs7Context *ctx);
diff --git a/gmime/gmime.c b/gmime/gmime.c
index 99c1c4a..4800dd5 100644
--- a/gmime/gmime.c
+++ b/gmime/gmime.c
@@ -39,6 +39,7 @@
extern gboolean _g_mime_enable_rfc2047_workarounds (void);
+GQuark gmime_gpgme_error_quark;
GQuark gmime_error_quark;
const guint gmime_major_version = GMIME_MAJOR_VERSION;
@@ -106,6 +107,7 @@ g_mime_init (guint32 flags)
g_mime_iconv_init ();
+ gmime_gpgme_error_quark = g_quark_from_static_string ("gmime-gpgme");
gmime_error_quark = g_quark_from_static_string ("gmime");
/* register our GObject types with the GType system */
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 5dc9fb3..fed11c4 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -124,8 +124,6 @@ print_verify_results (const GMimeSignatureValidity *validity)
fprintf (stdout, "\tErrors: ");
if (signer->errors & GMIME_SIGNER_ERROR_EXPSIG)
fputs ("Expired, ", stdout);
- if (signer->errors & GMIME_SIGNER_ERROR_REVSIG)
- fputs ("Revoked, ", stdout);
if (signer->errors & GMIME_SIGNER_ERROR_NO_PUBKEY)
fputs ("No Pub Key, ", stdout);
if (signer->errors & GMIME_SIGNER_ERROR_EXPKEYSIG)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]