[gmime] Renamed CipherContext -> CryptoContext
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Renamed CipherContext -> CryptoContext
- Date: Mon, 22 Nov 2010 23:20:00 +0000 (UTC)
commit 98296e56f3a912db869ec787e0d32705a95f00b9
Author: Jeffrey Stedfast <fejj gnome org>
Date: Mon Nov 22 18:15:31 2010 -0500
Renamed CipherContext -> CryptoContext
2010-11-22 Jeffrey Stedfast <fejj novell com>
Fixes bug #635491.
* gmime/gmime-crypto-context.[c,h]: Renamed from
gmime-cipher-context.[c,h].
ChangeLog | 7 +
docs/reference/gmime-docs.sgml | 8 +-
docs/reference/gmime-sections.txt | 40 ++--
examples/basic-example.c | 10 +-
gmime/Makefile.am | 4 +-
...ime-cipher-context.c => gmime-crypto-context.c} | 218 ++++++++++----------
...ime-cipher-context.h => gmime-crypto-context.h} | 124 ++++++------
gmime/gmime-gpg-context.c | 180 ++++++++--------
gmime/gmime-gpg-context.h | 12 +-
gmime/gmime-multipart-encrypted.c | 18 +-
gmime/gmime-multipart-encrypted.h | 6 +-
gmime/gmime-multipart-signed.c | 30 ++--
gmime/gmime-multipart-signed.h | 8 +-
gmime/gmime-pkcs7-context.c | 132 ++++++------
gmime/gmime-pkcs7-context.h | 12 +-
gmime/gmime.h | 2 +-
tests/test-pgp.c | 34 ++--
tests/test-pgpmime.c | 14 +-
tests/test-pkcs7.c | 34 ++--
tests/test-smime.c | 14 +-
tools/gmime-port-2-4-to-2-6.sh | 6 +
21 files changed, 463 insertions(+), 450 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f8bdc23..04ec850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-22 Jeffrey Stedfast <fejj novell com>
+
+ Fixes bug #635491.
+
+ * gmime/gmime-crypto-context.[c,h]: Renamed from
+ gmime-cipher-context.[c,h].
+
2010-11-21 Jeffrey Stedfast <fejj novell com>
Fixes bug #635407.
diff --git a/docs/reference/gmime-docs.sgml b/docs/reference/gmime-docs.sgml
index eb05b83..7ec4798 100644
--- a/docs/reference/gmime-docs.sgml
+++ b/docs/reference/gmime-docs.sgml
@@ -49,7 +49,7 @@
<!ENTITY GMimeFilterStrip SYSTEM "xml/gmime-filter-strip.xml">
<!ENTITY GMimeFilterWindows SYSTEM "xml/gmime-filter-windows.xml">
<!ENTITY GMimeFilterYenc SYSTEM "xml/gmime-filter-yenc.xml">
-<!ENTITY GMimeCipherContext SYSTEM "xml/gmime-cipher-context.xml">
+<!ENTITY GMimeCryptoContext SYSTEM "xml/gmime-crypto-context.xml">
<!ENTITY GMimeGpgContext SYSTEM "xml/gmime-gpg-context.xml">
<!ENTITY index-Class-Tree SYSTEM "tree_index.sgml">
@@ -244,9 +244,9 @@ string utilities, file utilities, a main loop abstraction, and so on.
&GMimeParser;
</chapter>
- <chapter id="CipherContexts">
- <title>Cipher Contexts</title>
- &GMimeCipherContext;
+ <chapter id="CryptoContexts">
+ <title>Cryptography Contexts</title>
+ &GMimeCryptoContext;
&GMimeGpgContext;
</chapter>
</part>
diff --git a/docs/reference/gmime-sections.txt b/docs/reference/gmime-sections.txt
index 706a71f..cedbd92 100644
--- a/docs/reference/gmime-sections.txt
+++ b/docs/reference/gmime-sections.txt
@@ -1136,25 +1136,25 @@ g_mime_iconv_locale_to_utf8_length
</SECTION>
<SECTION>
-<FILE>gmime-cipher-context</FILE>
+<FILE>gmime-crypto-context</FILE>
GMimePasswordRequestFunc
-GMimeCipherHash
-GMimeCipherContext
+GMimeCryptoHash
+GMimeCryptoContext
GMimeSignatureValidity
GMimeSignatureStatus
GMimeSignerStatus
GMimeSignerTrust
GMimeSignerError
GMimeSigner
-g_mime_cipher_context_set_request_password
-g_mime_cipher_context_hash_id
-g_mime_cipher_context_hash_name
-g_mime_cipher_context_sign
-g_mime_cipher_context_verify
-g_mime_cipher_context_encrypt
-g_mime_cipher_context_decrypt
-g_mime_cipher_context_import_keys
-g_mime_cipher_context_export_keys
+g_mime_crypto_context_set_request_password
+g_mime_crypto_context_hash_id
+g_mime_crypto_context_hash_name
+g_mime_crypto_context_sign
+g_mime_crypto_context_verify
+g_mime_crypto_context_encrypt
+g_mime_crypto_context_decrypt
+g_mime_crypto_context_import_keys
+g_mime_crypto_context_export_keys
<SUBSECTION>
g_mime_signer_new
g_mime_signer_free
@@ -1194,16 +1194,16 @@ g_mime_signature_validity_get_details
g_mime_signature_validity_add_signer
g_mime_signature_validity_get_signers
<SUBSECTION Private>
-g_mime_cipher_context_get_type
+g_mime_crypto_context_get_type
<SUBSECTION Standard>
-GMIME_CIPHER_CONTEXT
-GMIME_IS_CIPHER_CONTEXT
-GMIME_TYPE_CIPHER_CONTEXT
-GMIME_CIPHER_CONTEXT_CLASS
-GMIME_IS_CIPHER_CONTEXT_CLASS
-GMIME_CIPHER_CONTEXT_GET_CLASS
-GMimeCipherContextClass
+GMIME_CRYPTO_CONTEXT
+GMIME_IS_CRYPTO_CONTEXT
+GMIME_TYPE_CRYPTO_CONTEXT
+GMIME_CRYPTO_CONTEXT_CLASS
+GMIME_IS_CRYPTO_CONTEXT_CLASS
+GMIME_CRYPTO_CONTEXT_GET_CLASS
+GMimeCryptoContextClass
</SECTION>
<SECTION>
diff --git a/examples/basic-example.c b/examples/basic-example.c
index c0bc0dc..7fa3a89 100644
--- a/examples/basic-example.c
+++ b/examples/basic-example.c
@@ -39,7 +39,7 @@ static const char *path = "/usr/bin/gpg";
static const char *passphrase = "no.secret";
static gboolean
-request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
+request_passwd (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
{
if (g_mime_stream_write_string (response, passphrase) == -1 ||
g_mime_stream_write (response, "\n", 1) == -1) {
@@ -139,7 +139,7 @@ count_parts_in_message (GMimeMessage *message)
static void
verify_foreach_callback (GMimeObject *parent, GMimeObject *part, gpointer user_data)
{
- GMimeCipherContext *ctx = user_data;
+ GMimeCryptoContext *ctx = user_data;
if (GMIME_IS_MULTIPART_SIGNED (part)) {
/* this is a multipart/signed part, so we can verify the pgp signature */
@@ -185,7 +185,7 @@ verify_foreach_callback (GMimeObject *parent, GMimeObject *part, gpointer user_d
}
static void
-verify_signed_parts (GMimeMessage *message, GMimeCipherContext *ctx)
+verify_signed_parts (GMimeMessage *message, GMimeCryptoContext *ctx)
{
/* descend the mime tree and verify any signed parts */
g_mime_message_foreach (message, verify_foreach_callback, ctx);
@@ -283,7 +283,7 @@ remove_a_mime_part (GMimeMessage *message)
int main (int argc, char **argv)
{
#ifndef G_OS_WIN32
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
#endif
GMimeMessage *message;
int fd;
@@ -309,7 +309,7 @@ int main (int argc, char **argv)
#ifndef G_OS_WIN32
#ifdef ENABLE_CRYPTOGRAPHY
- /* create our cipher context */
+ /* create our crypto context */
ctx = g_mime_gpg_context_new (request_passwd, path);
/* don't allow auto key-retrival */
diff --git a/gmime/Makefile.am b/gmime/Makefile.am
index b8083d3..f074a41 100644
--- a/gmime/Makefile.am
+++ b/gmime/Makefile.am
@@ -21,9 +21,9 @@ lib_LTLIBRARIES = libgmime-2.6.la
libgmime_2_6_la_SOURCES = \
gmime.c \
gmime-charset.c \
- gmime-cipher-context.c \
gmime-common.c \
gmime-content-type.c \
+ gmime-crypto-context.c \
gmime-data-wrapper.c \
gmime-disposition.c \
gmime-encodings.c \
@@ -78,8 +78,8 @@ endif
gmimeinclude_HEADERS = \
gmime.h \
gmime-charset.h \
- gmime-cipher-context.h \
gmime-content-type.h \
+ gmime-crypto-context.h \
gmime-data-wrapper.h \
gmime-disposition.h \
gmime-encodings.h \
diff --git a/gmime/gmime-cipher-context.c b/gmime/gmime-crypto-context.c
similarity index 77%
rename from gmime/gmime-cipher-context.c
rename to gmime/gmime-crypto-context.c
index 76b7d92..dde39a9 100644
--- a/gmime/gmime-cipher-context.c
+++ b/gmime/gmime-crypto-context.c
@@ -23,49 +23,49 @@
#include <config.h>
#endif
-#include "gmime-cipher-context.h"
+#include "gmime-crypto-context.h"
#include "gmime-error.h"
/**
- * SECTION: gmime-cipher-context
- * @title: GMimeCipherContext
+ * SECTION: gmime-crypto-context
+ * @title: GMimeCryptoContext
* @short_description: Encryption/signing contexts
* @see_also:
*
- * A #GMimeCipherContext is used for encrypting, decrypting, signing
+ * A #GMimeCryptoContext is used for encrypting, decrypting, signing
* and verifying cryptographic signatures.
**/
-static void g_mime_cipher_context_class_init (GMimeCipherContextClass *klass);
-static void g_mime_cipher_context_init (GMimeCipherContext *ctx, GMimeCipherContextClass *klass);
-static void g_mime_cipher_context_finalize (GObject *object);
+static void g_mime_crypto_context_class_init (GMimeCryptoContextClass *klass);
+static void g_mime_crypto_context_init (GMimeCryptoContext *ctx, GMimeCryptoContextClass *klass);
+static void g_mime_crypto_context_finalize (GObject *object);
-static GMimeCipherHash cipher_hash_id (GMimeCipherContext *ctx, const char *hash);
+static GMimeCryptoHash crypto_hash_id (GMimeCryptoContext *ctx, const char *hash);
-static const char *cipher_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash);
+static const char *crypto_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash);
-static int cipher_sign (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
+static int crypto_sign (GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static GMimeSignatureValidity *cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
+static GMimeSignatureValidity *crypto_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err);
-static int cipher_encrypt (GMimeCipherContext *ctx, gboolean sign,
+static int crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
-static GMimeSignatureValidity *cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+static GMimeSignatureValidity *crypto_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static int cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream,
+static int crypto_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
GError **err);
-static int cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+static int crypto_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
@@ -73,24 +73,24 @@ static GObjectClass *parent_class = NULL;
GType
-g_mime_cipher_context_get_type (void)
+g_mime_crypto_context_get_type (void)
{
static GType type = 0;
if (!type) {
static const GTypeInfo info = {
- sizeof (GMimeCipherContextClass),
+ sizeof (GMimeCryptoContextClass),
NULL, /* base_class_init */
NULL, /* base_class_finalize */
- (GClassInitFunc) g_mime_cipher_context_class_init,
+ (GClassInitFunc) g_mime_crypto_context_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
- sizeof (GMimeCipherContext),
+ sizeof (GMimeCryptoContext),
0, /* n_preallocs */
- (GInstanceInitFunc) g_mime_cipher_context_init,
+ (GInstanceInitFunc) g_mime_crypto_context_init,
};
- type = g_type_register_static (G_TYPE_OBJECT, "GMimeCipherContext", &info, 0);
+ type = g_type_register_static (G_TYPE_OBJECT, "GMimeCryptoContext", &info, 0);
}
return type;
@@ -98,66 +98,66 @@ g_mime_cipher_context_get_type (void)
static void
-g_mime_cipher_context_class_init (GMimeCipherContextClass *klass)
+g_mime_crypto_context_class_init (GMimeCryptoContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
- object_class->finalize = g_mime_cipher_context_finalize;
+ object_class->finalize = g_mime_crypto_context_finalize;
- klass->hash_id = cipher_hash_id;
- klass->hash_name = cipher_hash_name;
- klass->sign = cipher_sign;
- klass->verify = cipher_verify;
- klass->encrypt = cipher_encrypt;
- klass->decrypt = cipher_decrypt;
- klass->import_keys = cipher_import_keys;
- klass->export_keys = cipher_export_keys;
+ klass->hash_id = crypto_hash_id;
+ klass->hash_name = crypto_hash_name;
+ klass->sign = crypto_sign;
+ klass->verify = crypto_verify;
+ klass->encrypt = crypto_encrypt;
+ klass->decrypt = crypto_decrypt;
+ klass->import_keys = crypto_import_keys;
+ klass->export_keys = crypto_export_keys;
}
static void
-g_mime_cipher_context_init (GMimeCipherContext *ctx, GMimeCipherContextClass *klass)
+g_mime_crypto_context_init (GMimeCryptoContext *ctx, GMimeCryptoContextClass *klass)
{
ctx->request_passwd = NULL;
}
static void
-g_mime_cipher_context_finalize (GObject *object)
+g_mime_crypto_context_finalize (GObject *object)
{
- GMimeCipherContext *ctx = (GMimeCipherContext *) object;
+ GMimeCryptoContext *ctx = (GMimeCryptoContext *) object;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GMimeCipherHash
-cipher_hash_id (GMimeCipherContext *ctx, const char *hash)
+static GMimeCryptoHash
+crypto_hash_id (GMimeCryptoContext *ctx, const char *hash)
{
- return GMIME_CIPHER_HASH_DEFAULT;
+ return GMIME_CRYPTO_HASH_DEFAULT;
}
/**
- * g_mime_cipher_context_set_request_password:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_set_request_password:
+ * @ctx: a #GMimeCryptoContext
* @request_passwd: a callback function for requesting a password
*
* Sets the function used by the @ctx for requesting a password from
* the user.
**/
void
-g_mime_cipher_context_set_request_password (GMimeCipherContext *ctx, GMimePasswordRequestFunc request_passwd)
+g_mime_crypto_context_set_request_password (GMimeCryptoContext *ctx, GMimePasswordRequestFunc request_passwd)
{
- g_return_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx));
+ g_return_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx));
ctx->request_passwd = request_passwd;
}
/**
- * g_mime_cipher_context_get_request_password:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_get_request_password:
+ * @ctx: a #GMimeCryptoContext
*
* Gets the function used by the @ctx for requesting a password from
* the user.
@@ -165,43 +165,43 @@ g_mime_cipher_context_set_request_password (GMimeCipherContext *ctx, GMimePasswo
* Returns: a #GMimePasswordRequestFunc or %NULL if not set.
**/
GMimePasswordRequestFunc
-g_mime_cipher_context_get_request_password (GMimeCipherContext *ctx)
+g_mime_crypto_context_get_request_password (GMimeCryptoContext *ctx)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
return ctx->request_passwd;
}
/**
- * g_mime_cipher_context_hash_id:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_hash_id:
+ * @ctx: a #GMimeCryptoContext
* @hash: hash name
*
* Gets the hash id based on the hash name @hash.
*
- * Returns: the equivalent hash id or #GMIME_CIPHER_HASH_DEFAULT on fail.
+ * Returns: the equivalent hash id or #GMIME_CRYPTO_HASH_DEFAULT on fail.
**/
-GMimeCipherHash
-g_mime_cipher_context_hash_id (GMimeCipherContext *ctx, const char *hash)
+GMimeCryptoHash
+g_mime_crypto_context_hash_id (GMimeCryptoContext *ctx, const char *hash)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), GMIME_CIPHER_HASH_DEFAULT);
- g_return_val_if_fail (hash != NULL, GMIME_CIPHER_HASH_DEFAULT);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), GMIME_CRYPTO_HASH_DEFAULT);
+ g_return_val_if_fail (hash != NULL, GMIME_CRYPTO_HASH_DEFAULT);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->hash_id (ctx, hash);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->hash_id (ctx, hash);
}
static const char *
-cipher_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
+crypto_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash)
{
return NULL;
}
/**
- * g_mime_cipher_context_hash_name:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_hash_name:
+ * @ctx: a #GMimeCryptoContext
* @hash: hash id
*
* Gets the hash name based on the hash id @hash.
@@ -209,28 +209,28 @@ cipher_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
* Returns: the equivalent hash name or %NULL on fail.
**/
const char *
-g_mime_cipher_context_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
+g_mime_crypto_context_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->hash_name (ctx, hash);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->hash_name (ctx, hash);
}
static int
-cipher_sign (GMimeCipherContext *ctx, const char *userid, GMimeCipherHash hash,
+crypto_sign (GMimeCryptoContext *ctx, const char *userid, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "Signing is not supported by this cipher");
+ "Signing is not supported by this crypto context");
return -1;
}
/**
- * g_mime_cipher_context_sign:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_sign:
+ * @ctx: a #GMimeCryptoContext
* @userid: private key to use to sign the stream
* @hash: preferred Message-Integrity-Check hash algorithm
* @istream: input stream
@@ -239,35 +239,35 @@ cipher_sign (GMimeCipherContext *ctx, const char *userid, GMimeCipherHash hash,
*
* Signs the input stream and writes the resulting signature to the output stream.
*
- * Returns: the #GMimeCipherHash used on success (useful if @hash is
- * specified as #GMIME_CIPHER_HASH_DEFAULT) or %-1 on fail.
+ * Returns: the #GMimeCryptoHash used on success (useful if @hash is
+ * specified as #GMIME_CRYPTO_HASH_DEFAULT) or %-1 on fail.
**/
int
-g_mime_cipher_context_sign (GMimeCipherContext *ctx, const char *userid, GMimeCipherHash hash,
+g_mime_crypto_context_sign (GMimeCryptoContext *ctx, const char *userid, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (istream), -1);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), -1);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->sign (ctx, userid, hash, istream, ostream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->sign (ctx, userid, hash, istream, ostream, err);
}
static GMimeSignatureValidity *
-cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash, GMimeStream *istream,
+crypto_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *sigstream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "Verifying is not supported by this cipher");
+ "Verifying is not supported by this crypto context");
return NULL;
}
/**
- * g_mime_cipher_context_verify:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_verify:
+ * @ctx: a #GMimeCryptoContext
* @hash: secure hash used
* @istream: input stream
* @sigstream: optional detached-signature stream
@@ -283,73 +283,73 @@ cipher_verify (GMimeCipherContext *ctx, GMimeCipherHash hash, GMimeStream *istre
* execute at all.
**/
GMimeSignatureValidity *
-g_mime_cipher_context_verify (GMimeCipherContext *ctx, GMimeCipherHash hash, GMimeStream *istream,
+g_mime_crypto_context_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *sigstream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
g_return_val_if_fail (GMIME_IS_STREAM (istream), NULL);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->verify (ctx, hash, istream, sigstream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->verify (ctx, hash, istream, sigstream, err);
}
static int
-cipher_encrypt (GMimeCipherContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
+crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "Encryption is not supported by this cipher");
+ "Encryption is not supported by this crypto context");
return -1;
}
/**
- * g_mime_cipher_context_encrypt:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_encrypt:
+ * @ctx: a #GMimeCryptoContext
* @sign: sign as well as encrypt
* @userid: key id (or email address) to use when signing (assuming @sign is %TRUE)
* @recipients: an array of recipient key ids and/or email addresses
* @istream: cleartext input stream
- * @ostream: ciphertext output stream
+ * @ostream: cryptotext output stream
* @err: a #GError
*
* Encrypts (and optionally signs) the cleartext input stream and
- * writes the resulting ciphertext to the output stream.
+ * writes the resulting cryptotext to the output stream.
*
* Returns: %0 on success or %-1 on fail.
**/
int
-g_mime_cipher_context_encrypt (GMimeCipherContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
+g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (istream), -1);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), -1);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->encrypt (ctx, sign, userid, recipients, istream, ostream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->encrypt (ctx, sign, userid, recipients, istream, ostream, err);
}
static GMimeSignatureValidity *
-cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+crypto_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "Decryption is not supported by this cipher");
+ "Decryption is not supported by this crypto context");
return NULL;
}
/**
- * g_mime_cipher_context_decrypt:
- * @ctx: a #GMimeCipherContext
- * @istream: input/ciphertext stream
+ * g_mime_crypto_context_decrypt:
+ * @ctx: a #GMimeCryptoContext
+ * @istream: input/cryptotext stream
* @ostream: output/cleartext stream
* @err: a #GError
*
- * Decrypts the ciphertext input stream and writes the resulting
+ * Decrypts the cryptotext input stream and writes the resulting
* cleartext to the output stream.
*
* If the encrypted input stream was also signed, the returned
@@ -364,30 +364,30 @@ cipher_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
* Returns: a #GMimeSignatureValidity on success or %NULL on error.
**/
GMimeSignatureValidity *
-g_mime_cipher_context_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
g_return_val_if_fail (GMIME_IS_STREAM (istream), NULL);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), NULL);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->decrypt (ctx, istream, ostream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->decrypt (ctx, istream, ostream, err);
}
static int
-cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream, GError **err)
+crypto_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "You may not import keys with this cipher");
+ "You may not import keys with this crypto");
return -1;
}
/**
- * g_mime_cipher_context_import_keys:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_import_keys:
+ * @ctx: a #GMimeCryptoContext
* @istream: input stream (containing keys)
* @err: a #GError
*
@@ -397,29 +397,29 @@ cipher_import_keys (GMimeCipherContext *ctx, GMimeStream *istream, GError **err)
* Returns: %0 on success or %-1 on fail.
**/
int
-g_mime_cipher_context_import_keys (GMimeCipherContext *ctx, GMimeStream *istream, GError **err)
+g_mime_crypto_context_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (istream), -1);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->import_keys (ctx, istream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->import_keys (ctx, istream, err);
}
static int
-cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+crypto_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
- "You may not export keys with this cipher");
+ "You may not export keys with this crypto");
return -1;
}
/**
- * g_mime_cipher_context_export_keys:
- * @ctx: a #GMimeCipherContext
+ * g_mime_crypto_context_export_keys:
+ * @ctx: a #GMimeCryptoContext
* @keys: an array of key ids
* @ostream: output stream
* @err: a #GError
@@ -430,14 +430,14 @@ cipher_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
* Returns: %0 on success or %-1 on fail.
**/
int
-g_mime_cipher_context_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+g_mime_crypto_context_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err)
{
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), -1);
g_return_val_if_fail (keys != NULL, -1);
- return GMIME_CIPHER_CONTEXT_GET_CLASS (ctx)->export_keys (ctx, keys, ostream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->export_keys (ctx, keys, ostream, err);
}
@@ -1068,7 +1068,7 @@ g_mime_signature_validity_set_details (GMimeSignatureValidity *validity, const c
* Gets the list of signers.
*
* Returns: a #GMimeSigner list which contain further information such
- * as trust and cipher keys.
+ * as trust and crypto keys.
**/
const GMimeSigner *
g_mime_signature_validity_get_signers (const GMimeSignatureValidity *validity)
diff --git a/gmime/gmime-cipher-context.h b/gmime/gmime-crypto-context.h
similarity index 74%
rename from gmime/gmime-cipher-context.h
rename to gmime/gmime-crypto-context.h
index 25e0d29..4113dc5 100644
--- a/gmime/gmime-cipher-context.h
+++ b/gmime/gmime-crypto-context.h
@@ -19,8 +19,8 @@
*/
-#ifndef __GMIME_CIPHER_CONTEXT_H__
-#define __GMIME_CIPHER_CONTEXT_H__
+#ifndef __GMIME_CRYPTO_CONTEXT_H__
+#define __GMIME_CRYPTO_CONTEXT_H__
#include <glib.h>
#include <glib-object.h>
@@ -31,15 +31,15 @@
G_BEGIN_DECLS
-#define GMIME_TYPE_CIPHER_CONTEXT (g_mime_cipher_context_get_type ())
-#define GMIME_CIPHER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_CIPHER_CONTEXT, GMimeCipherContext))
-#define GMIME_CIPHER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_CIPHER_CONTEXT, GMimeCipherContextClass))
-#define GMIME_IS_CIPHER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_CIPHER_CONTEXT))
-#define GMIME_IS_CIPHER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_CIPHER_CONTEXT))
-#define GMIME_CIPHER_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_CIPHER_CONTEXT, GMimeCipherContextClass))
+#define GMIME_TYPE_CRYPTO_CONTEXT (g_mime_crypto_context_get_type ())
+#define GMIME_CRYPTO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_CRYPTO_CONTEXT, GMimeCryptoContext))
+#define GMIME_CRYPTO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_CRYPTO_CONTEXT, GMimeCryptoContextClass))
+#define GMIME_IS_CRYPTO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_CRYPTO_CONTEXT))
+#define GMIME_IS_CRYPTO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_CRYPTO_CONTEXT))
+#define GMIME_CRYPTO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_CRYPTO_CONTEXT, GMimeCryptoContextClass))
-typedef struct _GMimeCipherContext GMimeCipherContext;
-typedef struct _GMimeCipherContextClass GMimeCipherContextClass;
+typedef struct _GMimeCryptoContext GMimeCryptoContext;
+typedef struct _GMimeCryptoContextClass GMimeCryptoContextClass;
typedef struct _GMimeSigner GMimeSigner;
typedef struct _GMimeSignatureValidity GMimeSignatureValidity;
@@ -47,55 +47,55 @@ typedef struct _GMimeSignatureValidity GMimeSignatureValidity;
/**
* GMimePasswordRequestFunc:
- * @ctx: the #GMimeCipherContext making the request
+ * @ctx: the #GMimeCryptoContext making the request
* @user_id: the user_id of the password being requested
* @prompt_ctx: a string containing some helpful context for the prompt
* @reprompt: %TRUE if this password request is a reprompt due to a previously bad password response
* @response: a stream for the application to write the password to (followed by a newline '\n' character)
* @err: a #GError for the callback to set if an error occurs
*
- * A password request callback allowing a #GMimeCipherContext to
+ * A password request callback allowing a #GMimeCryptoContext to
* prompt the user for a password for a given key.
*
* Returns: %TRUE on success or %FALSE on error.
**/
-typedef gboolean (* GMimePasswordRequestFunc) (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx,
+typedef gboolean (* GMimePasswordRequestFunc) (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx,
gboolean reprompt, GMimeStream *response, GError **err);
/**
- * GMimeCipherHash:
- * @GMIME_CIPHER_HASH_DEFAULT: The default hash algorithm.
- * @GMIME_CIPHER_HASH_MD2: The MD2 hash algorithm.
- * @GMIME_CIPHER_HASH_MD5: The MD5 hash algorithm.
- * @GMIME_CIPHER_HASH_SHA1: The SHA-1 hash algorithm.
- * @GMIME_CIPHER_HASH_SHA224: The SHA-224 hash algorithm.
- * @GMIME_CIPHER_HASH_SHA256: The SHA-256 hash algorithm.
- * @GMIME_CIPHER_HASH_SHA384: The SHA-384 hash algorithm.
- * @GMIME_CIPHER_HASH_SHA512: The SHA-512 hash algorithm.
- * @GMIME_CIPHER_HASH_RIPEMD160: The RIPEMD-160 hash algorithm.
- * @GMIME_CIPHER_HASH_TIGER192: The TIGER-192 hash algorithm.
- * @GMIME_CIPHER_HASH_HAVAL5160: The HAVAL5-160 hash algorithm.
+ * GMimeCryptoHash:
+ * @GMIME_CRYPTO_HASH_DEFAULT: The default hash algorithm.
+ * @GMIME_CRYPTO_HASH_MD2: The MD2 hash algorithm.
+ * @GMIME_CRYPTO_HASH_MD5: The MD5 hash algorithm.
+ * @GMIME_CRYPTO_HASH_SHA1: The SHA-1 hash algorithm.
+ * @GMIME_CRYPTO_HASH_SHA224: The SHA-224 hash algorithm.
+ * @GMIME_CRYPTO_HASH_SHA256: The SHA-256 hash algorithm.
+ * @GMIME_CRYPTO_HASH_SHA384: The SHA-384 hash algorithm.
+ * @GMIME_CRYPTO_HASH_SHA512: The SHA-512 hash algorithm.
+ * @GMIME_CRYPTO_HASH_RIPEMD160: The RIPEMD-160 hash algorithm.
+ * @GMIME_CRYPTO_HASH_TIGER192: The TIGER-192 hash algorithm.
+ * @GMIME_CRYPTO_HASH_HAVAL5160: The HAVAL5-160 hash algorithm.
*
* A hash algorithm.
**/
typedef enum {
- GMIME_CIPHER_HASH_DEFAULT,
- GMIME_CIPHER_HASH_MD2,
- GMIME_CIPHER_HASH_MD5,
- GMIME_CIPHER_HASH_SHA1,
- GMIME_CIPHER_HASH_SHA224,
- GMIME_CIPHER_HASH_SHA256,
- GMIME_CIPHER_HASH_SHA384,
- GMIME_CIPHER_HASH_SHA512,
- GMIME_CIPHER_HASH_RIPEMD160,
- GMIME_CIPHER_HASH_TIGER192,
- GMIME_CIPHER_HASH_HAVAL5160
-} GMimeCipherHash;
+ GMIME_CRYPTO_HASH_DEFAULT,
+ GMIME_CRYPTO_HASH_MD2,
+ GMIME_CRYPTO_HASH_MD5,
+ GMIME_CRYPTO_HASH_SHA1,
+ GMIME_CRYPTO_HASH_SHA224,
+ GMIME_CRYPTO_HASH_SHA256,
+ GMIME_CRYPTO_HASH_SHA384,
+ GMIME_CRYPTO_HASH_SHA512,
+ GMIME_CRYPTO_HASH_RIPEMD160,
+ GMIME_CRYPTO_HASH_TIGER192,
+ GMIME_CRYPTO_HASH_HAVAL5160
+} GMimeCryptoHash;
/**
- * GMimeCipherContext:
+ * GMimeCryptoContext:
* @parent_object: parent #GObject
* @request_passwd: a callback for requesting a password
* @sign_protocol: signature protocol (must be set by subclass)
@@ -104,7 +104,7 @@ typedef enum {
*
* A crypto context for use with MIME.
**/
-struct _GMimeCipherContext {
+struct _GMimeCryptoContext {
GObject parent_object;
GMimePasswordRequestFunc request_passwd;
@@ -115,68 +115,68 @@ struct _GMimeCipherContext {
const char *key_protocol;
};
-struct _GMimeCipherContextClass {
+struct _GMimeCryptoContextClass {
GObjectClass parent_class;
- GMimeCipherHash (* hash_id) (GMimeCipherContext *ctx, const char *hash);
+ GMimeCryptoHash (* hash_id) (GMimeCryptoContext *ctx, const char *hash);
- const char * (* hash_name) (GMimeCipherContext *ctx, GMimeCipherHash hash);
+ const char * (* hash_name) (GMimeCryptoContext *ctx, GMimeCryptoHash hash);
- int (* sign) (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
+ int (* sign) (GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
- GMimeSignatureValidity * (* verify) (GMimeCipherContext *ctx, GMimeCipherHash hash,
+ GMimeSignatureValidity * (* verify) (GMimeCryptoContext *ctx, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err);
- int (* encrypt) (GMimeCipherContext *ctx, gboolean sign,
+ int (* encrypt) (GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
- GMimeSignatureValidity * (* decrypt) (GMimeCipherContext *ctx, GMimeStream *istream,
+ GMimeSignatureValidity * (* decrypt) (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err);
- int (* import_keys) (GMimeCipherContext *ctx, GMimeStream *istream,
+ int (* import_keys) (GMimeCryptoContext *ctx, GMimeStream *istream,
GError **err);
- int (* export_keys) (GMimeCipherContext *ctx, GPtrArray *keys,
+ int (* export_keys) (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
};
-GType g_mime_cipher_context_get_type (void);
+GType g_mime_crypto_context_get_type (void);
-void g_mime_cipher_context_set_request_password (GMimeCipherContext *ctx, GMimePasswordRequestFunc request_passwd);
+void g_mime_crypto_context_set_request_password (GMimeCryptoContext *ctx, GMimePasswordRequestFunc request_passwd);
/* hash routines */
-GMimeCipherHash g_mime_cipher_context_hash_id (GMimeCipherContext *ctx, const char *hash);
+GMimeCryptoHash g_mime_crypto_context_hash_id (GMimeCryptoContext *ctx, const char *hash);
-const char * g_mime_cipher_context_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash);
+const char * g_mime_crypto_context_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash);
-/* cipher routines */
-int g_mime_cipher_context_sign (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
+/* crypto routines */
+int g_mime_crypto_context_sign (GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-GMimeSignatureValidity *g_mime_cipher_context_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
+GMimeSignatureValidity *g_mime_crypto_context_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err);
-int g_mime_cipher_context_encrypt (GMimeCipherContext *ctx, gboolean sign,
+int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
-GMimeSignatureValidity *g_mime_cipher_context_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+GMimeSignatureValidity *g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err);
/* key/certificate routines */
-int g_mime_cipher_context_import_keys (GMimeCipherContext *ctx, GMimeStream *istream,
+int g_mime_crypto_context_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
GError **err);
-int g_mime_cipher_context_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+int g_mime_crypto_context_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
@@ -371,4 +371,4 @@ void g_mime_signature_validity_add_signer (GMimeSignatureVal
G_END_DECLS
-#endif /* __GMIME_CIPHER_CONTEXT_H__ */
+#endif /* __GMIME_CRYPTO_CONTEXT_H__ */
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 621dd62..9622317 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -62,10 +62,10 @@
/**
* SECTION: gmime-gpg-context
* @title: GMimeGpgContext
- * @short_description: GnuPG cipher contexts
- * @see_also: #GMimeCipherContext
+ * @short_description: GnuPG crypto contexts
+ * @see_also: #GMimeCryptoContext
*
- * A #GMimeGpgContext is a #GMimeCipherContext that uses GnuPG to do
+ * A #GMimeGpgContext is a #GMimeCryptoContext that uses GnuPG to do
* all of the encryption and digital signatures.
**/
@@ -74,34 +74,34 @@ static void g_mime_gpg_context_class_init (GMimeGpgContextClass *klass);
static void g_mime_gpg_context_init (GMimeGpgContext *ctx, GMimeGpgContextClass *klass);
static void g_mime_gpg_context_finalize (GObject *object);
-static GMimeCipherHash gpg_hash_id (GMimeCipherContext *ctx, const char *hash);
+static GMimeCryptoHash gpg_hash_id (GMimeCryptoContext *ctx, const char *hash);
-static const char *gpg_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash);
+static const char *gpg_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash);
-static int gpg_sign (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
+static int gpg_sign (GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static GMimeSignatureValidity *gpg_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
+static GMimeSignatureValidity *gpg_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err);
-static int gpg_encrypt (GMimeCipherContext *ctx, gboolean sign,
+static int gpg_encrypt (GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
-static GMimeSignatureValidity *gpg_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+static GMimeSignatureValidity *gpg_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static int gpg_import_keys (GMimeCipherContext *ctx, GMimeStream *istream,
+static int gpg_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
GError **err);
-static int gpg_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+static int gpg_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
-static GMimeCipherContextClass *parent_class = NULL;
+static GMimeCryptoContextClass *parent_class = NULL;
GType
@@ -122,7 +122,7 @@ g_mime_gpg_context_get_type (void)
(GInstanceInitFunc) g_mime_gpg_context_init,
};
- type = g_type_register_static (GMIME_TYPE_CIPHER_CONTEXT, "GMimeGpgContext", &info, 0);
+ type = g_type_register_static (GMIME_TYPE_CRYPTO_CONTEXT, "GMimeGpgContext", &info, 0);
}
return type;
@@ -133,34 +133,34 @@ static void
g_mime_gpg_context_class_init (GMimeGpgContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GMimeCipherContextClass *cipher_class = GMIME_CIPHER_CONTEXT_CLASS (klass);
+ GMimeCryptoContextClass *crypto_class = GMIME_CRYPTO_CONTEXT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_class->finalize = g_mime_gpg_context_finalize;
- cipher_class->hash_id = gpg_hash_id;
- cipher_class->hash_name = gpg_hash_name;
- cipher_class->sign = gpg_sign;
- cipher_class->verify = gpg_verify;
- cipher_class->encrypt = gpg_encrypt;
- cipher_class->decrypt = gpg_decrypt;
- cipher_class->import_keys = gpg_import_keys;
- cipher_class->export_keys = gpg_export_keys;
+ crypto_class->hash_id = gpg_hash_id;
+ crypto_class->hash_name = gpg_hash_name;
+ crypto_class->sign = gpg_sign;
+ crypto_class->verify = gpg_verify;
+ crypto_class->encrypt = gpg_encrypt;
+ crypto_class->decrypt = gpg_decrypt;
+ crypto_class->import_keys = gpg_import_keys;
+ crypto_class->export_keys = gpg_export_keys;
}
static void
g_mime_gpg_context_init (GMimeGpgContext *ctx, GMimeGpgContextClass *klass)
{
- GMimeCipherContext *cipher = (GMimeCipherContext *) ctx;
+ GMimeCryptoContext *crypto = (GMimeCryptoContext *) ctx;
ctx->auto_key_retrieve = FALSE;
ctx->always_trust = FALSE;
ctx->path = NULL;
- cipher->sign_protocol = "application/pgp-signature";
- cipher->encrypt_protocol = "application/pgp-encrypted";
- cipher->key_protocol = "application/pgp-keys";
+ crypto->sign_protocol = "application/pgp-signature";
+ crypto->encrypt_protocol = "application/pgp-encrypted";
+ crypto->key_protocol = "application/pgp-keys";
}
static void
@@ -173,62 +173,62 @@ g_mime_gpg_context_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GMimeCipherHash
-gpg_hash_id (GMimeCipherContext *ctx, const char *hash)
+static GMimeCryptoHash
+gpg_hash_id (GMimeCryptoContext *ctx, const char *hash)
{
if (hash == NULL)
- return GMIME_CIPHER_HASH_DEFAULT;
+ return GMIME_CRYPTO_HASH_DEFAULT;
if (!g_ascii_strcasecmp (hash, "pgp-"))
hash += 4;
if (!g_ascii_strcasecmp (hash, "md2"))
- return GMIME_CIPHER_HASH_MD2;
+ return GMIME_CRYPTO_HASH_MD2;
else if (!g_ascii_strcasecmp (hash, "md5"))
- return GMIME_CIPHER_HASH_MD5;
+ return GMIME_CRYPTO_HASH_MD5;
else if (!g_ascii_strcasecmp (hash, "sha1"))
- return GMIME_CIPHER_HASH_SHA1;
+ return GMIME_CRYPTO_HASH_SHA1;
else if (!g_ascii_strcasecmp (hash, "sha224"))
- return GMIME_CIPHER_HASH_SHA224;
+ return GMIME_CRYPTO_HASH_SHA224;
else if (!g_ascii_strcasecmp (hash, "sha256"))
- return GMIME_CIPHER_HASH_SHA256;
+ return GMIME_CRYPTO_HASH_SHA256;
else if (!g_ascii_strcasecmp (hash, "sha384"))
- return GMIME_CIPHER_HASH_SHA384;
+ return GMIME_CRYPTO_HASH_SHA384;
else if (!g_ascii_strcasecmp (hash, "sha512"))
- return GMIME_CIPHER_HASH_SHA512;
+ return GMIME_CRYPTO_HASH_SHA512;
else if (!g_ascii_strcasecmp (hash, "ripemd160"))
- return GMIME_CIPHER_HASH_RIPEMD160;
+ return GMIME_CRYPTO_HASH_RIPEMD160;
else if (!g_ascii_strcasecmp (hash, "tiger192"))
- return GMIME_CIPHER_HASH_TIGER192;
+ return GMIME_CRYPTO_HASH_TIGER192;
else if (!g_ascii_strcasecmp (hash, "haval-5-160"))
- return GMIME_CIPHER_HASH_HAVAL5160;
+ return GMIME_CRYPTO_HASH_HAVAL5160;
- return GMIME_CIPHER_HASH_DEFAULT;
+ return GMIME_CRYPTO_HASH_DEFAULT;
}
static const char *
-gpg_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
+gpg_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash)
{
switch (hash) {
- case GMIME_CIPHER_HASH_MD2:
+ case GMIME_CRYPTO_HASH_MD2:
return "pgp-md2";
- case GMIME_CIPHER_HASH_MD5:
+ case GMIME_CRYPTO_HASH_MD5:
return "pgp-md5";
- case GMIME_CIPHER_HASH_SHA1:
+ case GMIME_CRYPTO_HASH_SHA1:
return "pgp-sha1";
- case GMIME_CIPHER_HASH_SHA224:
+ case GMIME_CRYPTO_HASH_SHA224:
return "pgp-sha224";
- case GMIME_CIPHER_HASH_SHA256:
+ case GMIME_CRYPTO_HASH_SHA256:
return "pgp-sha256";
- case GMIME_CIPHER_HASH_SHA384:
+ case GMIME_CRYPTO_HASH_SHA384:
return "pgp-sha384";
- case GMIME_CIPHER_HASH_SHA512:
+ case GMIME_CRYPTO_HASH_SHA512:
return "pgp-sha512";
- case GMIME_CIPHER_HASH_RIPEMD160:
+ case GMIME_CRYPTO_HASH_RIPEMD160:
return "pgp-ripemd160";
- case GMIME_CIPHER_HASH_TIGER192:
+ case GMIME_CRYPTO_HASH_TIGER192:
return "pgp-tiger192";
- case GMIME_CIPHER_HASH_HAVAL5160:
+ case GMIME_CRYPTO_HASH_HAVAL5160:
return "pgp-haval-5-160";
default:
return "pgp-sha1";
@@ -254,7 +254,7 @@ struct _GpgCtx {
char *userid;
GPtrArray *recipients;
- GMimeCipherHash hash;
+ GMimeCryptoHash hash;
int stdin_fd;
int stdout_fd;
@@ -324,7 +324,7 @@ gpg_ctx_new (GMimeGpgContext *ctx)
gpg->userid = NULL;
gpg->recipients = NULL;
- gpg->hash = GMIME_CIPHER_HASH_DEFAULT;
+ gpg->hash = GMIME_CRYPTO_HASH_DEFAULT;
gpg->always_trust = FALSE;
gpg->armor = FALSE;
@@ -390,7 +390,7 @@ gpg_ctx_set_mode (struct _GpgCtx *gpg, enum _GpgCtxMode mode)
}
static void
-gpg_ctx_set_hash (struct _GpgCtx *gpg, GMimeCipherHash hash)
+gpg_ctx_set_hash (struct _GpgCtx *gpg, GMimeCryptoHash hash)
{
gpg->hash = hash;
}
@@ -522,26 +522,26 @@ gpg_ctx_free (struct _GpgCtx *gpg)
}
static const char *
-gpg_hash_str (GMimeCipherHash hash)
+gpg_hash_str (GMimeCryptoHash hash)
{
switch (hash) {
- case GMIME_CIPHER_HASH_MD2:
+ case GMIME_CRYPTO_HASH_MD2:
return "--digest-algo=MD2";
- case GMIME_CIPHER_HASH_MD5:
+ case GMIME_CRYPTO_HASH_MD5:
return "--digest-algo=MD5";
- case GMIME_CIPHER_HASH_SHA1:
+ case GMIME_CRYPTO_HASH_SHA1:
return "--digest-algo=SHA1";
- case GMIME_CIPHER_HASH_SHA224:
+ case GMIME_CRYPTO_HASH_SHA224:
return "--digest-algo=SHA224";
- case GMIME_CIPHER_HASH_SHA256:
+ case GMIME_CRYPTO_HASH_SHA256:
return "--digest-algo=SHA256";
- case GMIME_CIPHER_HASH_SHA384:
+ case GMIME_CRYPTO_HASH_SHA384:
return "--digest-algo=SHA384";
- case GMIME_CIPHER_HASH_SHA512:
+ case GMIME_CRYPTO_HASH_SHA512:
return "--digest-algo=SHA512";
- case GMIME_CIPHER_HASH_RIPEMD160:
+ case GMIME_CRYPTO_HASH_RIPEMD160:
return "--digest-algo=RIPEMD160";
- case GMIME_CIPHER_HASH_TIGER192:
+ case GMIME_CRYPTO_HASH_TIGER192:
return "--digest-algo=TIGER192";
default:
return NULL;
@@ -1014,7 +1014,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
gpg->need_id = userid;
} else if (!strncmp (status, "GET_HIDDEN ", 11)) {
GMimeStream *filtered_stream, *passwd;
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
GMimeFilter *filter;
const char *charset;
char *prompt = NULL;
@@ -1023,7 +1023,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
status += 11;
- ctx = (GMimeCipherContext *) gpg->ctx;
+ ctx = (GMimeCryptoContext *) gpg->ctx;
if (!ctx->request_passwd) {
/* can't ask for a passwd w/o a way to request it from the user... */
g_set_error_literal (err, GMIME_ERROR, ECANCELED, _("Canceled."));
@@ -1130,16 +1130,16 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
/* this token is the hash algorithm used */
switch (strtol (status, NULL, 10)) {
- case 1: gpg->hash = GMIME_CIPHER_HASH_MD5; break;
- case 2: gpg->hash = GMIME_CIPHER_HASH_SHA1; break;
- case 3: gpg->hash = GMIME_CIPHER_HASH_RIPEMD160; break;
- case 5: gpg->hash = GMIME_CIPHER_HASH_MD2; break; /* ? */
- case 6: gpg->hash = GMIME_CIPHER_HASH_TIGER192; break; /* ? */
- case 7: gpg->hash = GMIME_CIPHER_HASH_HAVAL5160; break; /* ? */
- case 8: gpg->hash = GMIME_CIPHER_HASH_SHA256; break;
- case 9: gpg->hash = GMIME_CIPHER_HASH_SHA384; break;
- case 10: gpg->hash = GMIME_CIPHER_HASH_SHA512; break;
- case 11: gpg->hash = GMIME_CIPHER_HASH_SHA224; break;
+ case 1: gpg->hash = GMIME_CRYPTO_HASH_MD5; break;
+ case 2: gpg->hash = GMIME_CRYPTO_HASH_SHA1; break;
+ case 3: gpg->hash = GMIME_CRYPTO_HASH_RIPEMD160; break;
+ case 5: gpg->hash = GMIME_CRYPTO_HASH_MD2; break; /* ? */
+ case 6: gpg->hash = GMIME_CRYPTO_HASH_TIGER192; break; /* ? */
+ case 7: gpg->hash = GMIME_CRYPTO_HASH_HAVAL5160; break; /* ? */
+ case 8: gpg->hash = GMIME_CRYPTO_HASH_SHA256; break;
+ case 9: gpg->hash = GMIME_CRYPTO_HASH_SHA384; break;
+ case 10: gpg->hash = GMIME_CRYPTO_HASH_SHA512; break;
+ case 11: gpg->hash = GMIME_CRYPTO_HASH_SHA224; break;
default: break;
}
break;
@@ -1647,7 +1647,7 @@ gpg_ctx_op_wait (struct _GpgCtx *gpg)
static int
-gpg_sign (GMimeCipherContext *context, const char *userid, GMimeCipherHash hash,
+gpg_sign (GMimeCryptoContext *context, const char *userid, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
GMimeGpgContext *ctx = (GMimeGpgContext *) context;
@@ -1703,7 +1703,7 @@ gpg_sign (GMimeCipherContext *context, const char *userid, GMimeCipherHash hash,
static GMimeSignatureValidity *
-gpg_verify (GMimeCipherContext *context, GMimeCipherHash hash,
+gpg_verify (GMimeCryptoContext *context, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err)
{
@@ -1764,7 +1764,7 @@ gpg_verify (GMimeCipherContext *context, GMimeCipherHash hash,
static int
-gpg_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
+gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream,
GError **err)
{
@@ -1825,7 +1825,7 @@ gpg_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
static GMimeSignatureValidity *
-gpg_decrypt (GMimeCipherContext *context, GMimeStream *istream,
+gpg_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
GMimeStream *ostream, GError **err)
{
GMimeGpgContext *ctx = (GMimeGpgContext *) context;
@@ -1896,7 +1896,7 @@ gpg_decrypt (GMimeCipherContext *context, GMimeStream *istream,
}
static int
-gpg_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **err)
+gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err)
{
GMimeGpgContext *ctx = (GMimeGpgContext *) context;
struct _GpgCtx *gpg;
@@ -1943,7 +1943,7 @@ gpg_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **err
}
static int
-gpg_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
+gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
{
GMimeGpgContext *ctx = (GMimeGpgContext *) context;
struct _GpgCtx *gpg;
@@ -2001,14 +2001,14 @@ gpg_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *ostr
* @request_passwd: a #GMimePasswordRequestFunc
* @path: path to gpg binary
*
- * Creates a new gpg cipher context object.
+ * Creates a new gpg crypto context object.
*
- * Returns: a new gpg cipher context object.
+ * Returns: a new gpg crypto context object.
**/
-GMimeCipherContext *
+GMimeCryptoContext *
g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *path)
{
- GMimeCipherContext *cipher;
+ GMimeCryptoContext *crypto;
GMimeGpgContext *ctx;
g_return_val_if_fail (path != NULL, NULL);
@@ -2016,10 +2016,10 @@ g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *pat
ctx = g_object_newv (GMIME_TYPE_GPG_CONTEXT, 0, NULL);
ctx->path = g_strdup (path);
- cipher = (GMimeCipherContext *) ctx;
- cipher->request_passwd = request_passwd;
+ crypto = (GMimeCryptoContext *) ctx;
+ crypto->request_passwd = request_passwd;
- return cipher;
+ return crypto;
}
diff --git a/gmime/gmime-gpg-context.h b/gmime/gmime-gpg-context.h
index 0533ff8..6708312 100644
--- a/gmime/gmime-gpg-context.h
+++ b/gmime/gmime-gpg-context.h
@@ -22,7 +22,7 @@
#ifndef __GMIME_GPG_CONTEXT_H__
#define __GMIME_GPG_CONTEXT_H__
-#include <gmime/gmime-cipher-context.h>
+#include <gmime/gmime-crypto-context.h>
G_BEGIN_DECLS
@@ -39,21 +39,21 @@ typedef struct _GMimeGpgContextClass GMimeGpgContextClass;
/**
* GMimeGpgContext:
- * @parent_object: parent #GMimeCipherContext
+ * @parent_object: parent #GMimeCryptoContext
* @always_trust: %TRUE if keys should always be trusted
* @path: path to gpg
*
- * A GnuPG cipher context.
+ * A GnuPG crypto context.
**/
struct _GMimeGpgContext {
- GMimeCipherContext parent_object;
+ GMimeCryptoContext parent_object;
gboolean auto_key_retrieve;
gboolean always_trust;
char *path;
};
struct _GMimeGpgContextClass {
- GMimeCipherContextClass parent_class;
+ GMimeCryptoContextClass parent_class;
};
@@ -61,7 +61,7 @@ struct _GMimeGpgContextClass {
GType g_mime_gpg_context_get_type (void);
-GMimeCipherContext *g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *path);
+GMimeCryptoContext *g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *path);
gboolean g_mime_gpg_context_get_auto_key_retrieve (GMimeGpgContext *ctx);
void g_mime_gpg_context_set_auto_key_retrieve (GMimeGpgContext *ctx, gboolean auto_key_retrieve);
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index 0a82911..fbd110c 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -145,7 +145,7 @@ g_mime_multipart_encrypted_new (void)
* g_mime_multipart_encrypted_encrypt:
* @mpe: multipart/encrypted object
* @content: MIME part to encrypt
- * @ctx: encryption cipher context
+ * @ctx: encryption crypto context
* @sign: %TRUE if the content should also be signed or %FALSE otherwise
* @userid: user id to use for signing (only used if @sign is %TRUE)
* @recipients: an array of recipients to encrypt to
@@ -162,7 +162,7 @@ g_mime_multipart_encrypted_new (void)
**/
int
g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *content,
- GMimeCipherContext *ctx, gboolean sign,
+ GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GError **err)
{
@@ -173,7 +173,7 @@ g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *c
GMimeFilter *crlf_filter;
g_return_val_if_fail (GMIME_IS_MULTIPART_ENCRYPTED (mpe), -1);
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (ctx->encrypt_protocol != NULL, -1);
g_return_val_if_fail (GMIME_IS_OBJECT (content), -1);
@@ -194,7 +194,7 @@ g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *c
/* encrypt the content stream */
ciphertext = g_mime_stream_mem_new ();
- if (g_mime_cipher_context_encrypt (ctx, sign, userid, recipients, stream, ciphertext, err) == -1) {
+ if (g_mime_crypto_context_encrypt (ctx, sign, userid, recipients, stream, ciphertext, err) == -1) {
g_object_unref (ciphertext);
g_object_unref (stream);
return -1;
@@ -247,7 +247,7 @@ g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *c
/**
* g_mime_multipart_encrypted_decrypt:
* @mpe: multipart/encrypted object
- * @ctx: decryption cipher context
+ * @ctx: decryption crypto context
* @err: a #GError
*
* Attempts to decrypt the encrypted MIME part contained within the
@@ -262,7 +262,7 @@ g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *c
* information as to why the failure occured.
**/
GMimeObject *
-g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCipherContext *ctx,
+g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCryptoContext *ctx,
GError **err)
{
GMimeObject *decrypted, *version, *encrypted;
@@ -277,7 +277,7 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCipherCon
char *content_type;
g_return_val_if_fail (GMIME_IS_MULTIPART_ENCRYPTED (mpe), NULL);
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
g_return_val_if_fail (ctx->encrypt_protocol != NULL, NULL);
if (mpe->decrypted) {
@@ -288,7 +288,7 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCipherCon
protocol = g_mime_object_get_content_type_parameter (GMIME_OBJECT (mpe), "protocol");
if (protocol) {
- /* make sure the protocol matches the cipher encrypt protocol */
+ /* make sure the protocol matches the crypto encrypt protocol */
if (g_ascii_strcasecmp (ctx->encrypt_protocol, protocol) != 0) {
g_set_error (err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR,
"Cannot decrypt multipart/encrypted part: unsupported encryption protocol '%s'.",
@@ -337,7 +337,7 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCipherCon
g_object_unref (crlf_filter);
/* get the cleartext */
- if (!(sv = g_mime_cipher_context_decrypt (ctx, ciphertext, filtered_stream, err))) {
+ if (!(sv = g_mime_crypto_context_decrypt (ctx, ciphertext, filtered_stream, err))) {
g_object_unref (filtered_stream);
g_object_unref (stream);
diff --git a/gmime/gmime-multipart-encrypted.h b/gmime/gmime-multipart-encrypted.h
index c5f6b3f..12446b8 100644
--- a/gmime/gmime-multipart-encrypted.h
+++ b/gmime/gmime-multipart-encrypted.h
@@ -23,7 +23,7 @@
#define __GMIME_MULTIPART_ENCRYPTED_H__
#include <gmime/gmime-multipart.h>
-#include <gmime/gmime-cipher-context.h>
+#include <gmime/gmime-crypto-context.h>
G_BEGIN_DECLS
@@ -69,12 +69,12 @@ GType g_mime_multipart_encrypted_get_type (void);
GMimeMultipartEncrypted *g_mime_multipart_encrypted_new (void);
int g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObject *content,
- GMimeCipherContext *ctx, gboolean sign,
+ GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GError **err);
GMimeObject *g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe,
- GMimeCipherContext *ctx,
+ GMimeCryptoContext *ctx,
GError **err);
const GMimeSignatureValidity *g_mime_multipart_encrypted_get_signature_validity (GMimeMultipartEncrypted *mpe);
diff --git a/gmime/gmime-multipart-signed.c b/gmime/gmime-multipart-signed.c
index 81034f9..52f2f9c 100644
--- a/gmime/gmime-multipart-signed.c
+++ b/gmime/gmime-multipart-signed.c
@@ -192,7 +192,7 @@ sign_prepare (GMimeObject *mime_part)
* g_mime_multipart_signed_sign:
* @mps: multipart/signed object
* @content: MIME part to sign
- * @ctx: encryption cipher context
+ * @ctx: encryption crypto context
* @userid: user id to sign with
* @hash: preferred digest algorithm
* @err: exception
@@ -208,8 +208,8 @@ sign_prepare (GMimeObject *mime_part)
**/
int
g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
- GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GError **err)
+ GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GError **err)
{
GMimeStream *stream, *filtered, *sigstream;
GMimeContentType *content_type;
@@ -221,7 +221,7 @@ g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
int rv;
g_return_val_if_fail (GMIME_IS_MULTIPART_SIGNED (mps), -1);
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), -1);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (ctx->sign_protocol != NULL, -1);
g_return_val_if_fail (GMIME_IS_OBJECT (content), -1);
@@ -257,7 +257,7 @@ g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
sigstream = g_mime_stream_mem_new ();
/* sign the content stream */
- if ((rv = g_mime_cipher_context_sign (ctx, userid, hash, filtered, sigstream, err)) == -1) {
+ if ((rv = g_mime_crypto_context_sign (ctx, userid, hash, filtered, sigstream, err)) == -1) {
g_object_unref (sigstream);
g_object_unref (filtered);
g_object_unref (stream);
@@ -271,7 +271,7 @@ g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
/* set the multipart/signed protocol and micalg */
content_type = g_mime_object_get_content_type (GMIME_OBJECT (mps));
g_mime_content_type_set_parameter (content_type, "protocol", ctx->sign_protocol);
- micalg = g_strdup (g_mime_cipher_context_hash_name (ctx, (GMimeCipherHash) rv));
+ micalg = g_strdup (g_mime_crypto_context_hash_name (ctx, (GMimeCryptoHash) rv));
g_mime_content_type_set_parameter (content_type, "micalg", micalg);
g_mime_multipart_set_boundary (GMIME_MULTIPART (mps), NULL);
@@ -293,7 +293,7 @@ g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
g_object_unref (wrapper);
/* FIXME: temporary hack, this info should probably be set in
- * the CipherContext class - maybe ::sign can take/output a
+ * the CryptoContext class - maybe ::sign can take/output a
* GMimePart instead. */
if (!g_ascii_strcasecmp (ctx->sign_protocol, "application/pkcs7-signature")) {
g_mime_part_set_content_encoding (signature, GMIME_CONTENT_ENCODING_BASE64);
@@ -314,18 +314,18 @@ g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
/**
* g_mime_multipart_signed_verify:
* @mps: multipart/signed object
- * @ctx: encryption cipher context
+ * @ctx: encryption crypto context
* @err: exception
*
* Attempts to verify the signed MIME part contained within the
- * multipart/signed object @mps using the @ctx cipher context.
+ * multipart/signed object @mps using the @ctx crypto context.
*
* Returns: a new #GMimeSignatureValidity object on success or %NULL
* on fail. If the signing fails, an exception will be set on @err to
* provide information as to why the failure occured.
**/
GMimeSignatureValidity *
-g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeCipherContext *ctx,
+g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeCryptoContext *ctx,
GError **err)
{
GMimeObject *content, *signature;
@@ -335,11 +335,11 @@ g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeCipherContext *c
GMimeStream *stream, *sigstream;
const char *protocol, *micalg;
GMimeSignatureValidity *valid;
- GMimeCipherHash hash;
+ GMimeCryptoHash hash;
char *content_type;
g_return_val_if_fail (GMIME_IS_MULTIPART_SIGNED (mps), NULL);
- g_return_val_if_fail (GMIME_IS_CIPHER_CONTEXT (ctx), NULL);
+ g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
g_return_val_if_fail (ctx->sign_protocol != NULL, NULL);
if (g_mime_multipart_get_count ((GMimeMultipart *) mps) < 2) {
@@ -352,7 +352,7 @@ g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeCipherContext *c
micalg = g_mime_object_get_content_type_parameter (GMIME_OBJECT (mps), "micalg");
if (protocol) {
- /* make sure the protocol matches the cipher sign protocol */
+ /* make sure the protocol matches the crypto sign protocol */
if (g_ascii_strcasecmp (ctx->sign_protocol, protocol) != 0) {
g_set_error (err, GMIME_ERROR, GMIME_ERROR_PARSE_ERROR,
"Cannot verify multipart/signed part: unsupported signature protocol '%s'.",
@@ -410,8 +410,8 @@ g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeCipherContext *c
g_mime_stream_reset (sigstream);
/* verify the signature */
- hash = g_mime_cipher_context_hash_id (ctx, micalg);
- valid = g_mime_cipher_context_verify (ctx, hash, stream, sigstream, err);
+ hash = g_mime_crypto_context_hash_id (ctx, micalg);
+ valid = g_mime_crypto_context_verify (ctx, hash, stream, sigstream, err);
d(printf ("attempted to verify:\n----- BEGIN SIGNED PART -----\n%.*s----- END SIGNED PART -----\n",
(int) GMIME_STREAM_MEM (stream)->buffer->len, GMIME_STREAM_MEM (stream)->buffer->data));
diff --git a/gmime/gmime-multipart-signed.h b/gmime/gmime-multipart-signed.h
index 334939c..91c5722 100644
--- a/gmime/gmime-multipart-signed.h
+++ b/gmime/gmime-multipart-signed.h
@@ -23,7 +23,7 @@
#define __GMIME_MULTIPART_SIGNED_H__
#include <gmime/gmime-multipart.h>
-#include <gmime/gmime-cipher-context.h>
+#include <gmime/gmime-crypto-context.h>
G_BEGIN_DECLS
@@ -65,11 +65,11 @@ GType g_mime_multipart_signed_get_type (void);
GMimeMultipartSigned *g_mime_multipart_signed_new (void);
int g_mime_multipart_signed_sign (GMimeMultipartSigned *mps, GMimeObject *content,
- GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GError **err);
+ GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GError **err);
GMimeSignatureValidity *g_mime_multipart_signed_verify (GMimeMultipartSigned *mps,
- GMimeCipherContext *ctx,
+ GMimeCryptoContext *ctx,
GError **err);
G_END_DECLS
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index 331c0ac..e8f0bbb 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -54,10 +54,10 @@
/**
* SECTION: gmime-pkcs7-context
* @title: GMimePkcs7Context
- * @short_description: PKCS7 cipher contexts
- * @see_also: #GMimeCipherContext
+ * @short_description: PKCS7 crypto contexts
+ * @see_also: #GMimeCryptoContext
*
- * A #GMimePkcs7Context is a #GMimeCipherContext that uses GnuPG to do
+ * A #GMimePkcs7Context is a #GMimeCryptoContext that uses GnuPG to do
* all of the encryption and digital signatures.
**/
@@ -72,34 +72,34 @@ 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);
-static GMimeCipherHash pkcs7_hash_id (GMimeCipherContext *ctx, const char *hash);
+static GMimeCryptoHash pkcs7_hash_id (GMimeCryptoContext *ctx, const char *hash);
-static const char *pkcs7_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash);
+static const char *pkcs7_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash);
-static int pkcs7_sign (GMimeCipherContext *ctx, const char *userid,
- GMimeCipherHash hash, GMimeStream *istream,
+static int pkcs7_sign (GMimeCryptoContext *ctx, const char *userid,
+ GMimeCryptoHash hash, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static GMimeSignatureValidity *pkcs7_verify (GMimeCipherContext *ctx, GMimeCipherHash hash,
+static GMimeSignatureValidity *pkcs7_verify (GMimeCryptoContext *ctx, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err);
-static int pkcs7_encrypt (GMimeCipherContext *ctx, gboolean sign,
+static int pkcs7_encrypt (GMimeCryptoContext *ctx, gboolean sign,
const char *userid, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
-static GMimeSignatureValidity *pkcs7_decrypt (GMimeCipherContext *ctx, GMimeStream *istream,
+static GMimeSignatureValidity *pkcs7_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
GMimeStream *ostream, GError **err);
-static int pkcs7_import_keys (GMimeCipherContext *ctx, GMimeStream *istream,
+static int pkcs7_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
GError **err);
-static int pkcs7_export_keys (GMimeCipherContext *ctx, GPtrArray *keys,
+static int pkcs7_export_keys (GMimeCryptoContext *ctx, GPtrArray *keys,
GMimeStream *ostream, GError **err);
-static GMimeCipherContextClass *parent_class = NULL;
+static GMimeCryptoContextClass *parent_class = NULL;
GType
@@ -120,7 +120,7 @@ g_mime_pkcs7_context_get_type (void)
(GInstanceInitFunc) g_mime_pkcs7_context_init,
};
- type = g_type_register_static (GMIME_TYPE_CIPHER_CONTEXT, "GMimePkcs7Context", &info, 0);
+ type = g_type_register_static (GMIME_TYPE_CRYPTO_CONTEXT, "GMimePkcs7Context", &info, 0);
}
return type;
@@ -131,26 +131,26 @@ static void
g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GMimeCipherContextClass *cipher_class = GMIME_CIPHER_CONTEXT_CLASS (klass);
+ GMimeCryptoContextClass *crypto_class = GMIME_CRYPTO_CONTEXT_CLASS (klass);
parent_class = g_type_class_ref (G_TYPE_OBJECT);
object_class->finalize = g_mime_pkcs7_context_finalize;
- cipher_class->hash_id = pkcs7_hash_id;
- cipher_class->hash_name = pkcs7_hash_name;
- cipher_class->sign = pkcs7_sign;
- cipher_class->verify = pkcs7_verify;
- cipher_class->encrypt = pkcs7_encrypt;
- cipher_class->decrypt = pkcs7_decrypt;
- cipher_class->import_keys = pkcs7_import_keys;
- cipher_class->export_keys = pkcs7_export_keys;
+ crypto_class->hash_id = pkcs7_hash_id;
+ crypto_class->hash_name = pkcs7_hash_name;
+ crypto_class->sign = pkcs7_sign;
+ crypto_class->verify = pkcs7_verify;
+ crypto_class->encrypt = pkcs7_encrypt;
+ crypto_class->decrypt = pkcs7_decrypt;
+ crypto_class->import_keys = pkcs7_import_keys;
+ crypto_class->export_keys = pkcs7_export_keys;
}
static void
g_mime_pkcs7_context_init (GMimePkcs7Context *ctx, GMimePkcs7ContextClass *klass)
{
- GMimeCipherContext *cipher = (GMimeCipherContext *) ctx;
+ GMimeCryptoContext *crypto = (GMimeCryptoContext *) ctx;
ctx->priv = g_slice_new (Pkcs7Ctx);
ctx->priv->always_trust = FALSE;
@@ -158,9 +158,9 @@ g_mime_pkcs7_context_init (GMimePkcs7Context *ctx, GMimePkcs7ContextClass *klass
ctx->priv->ctx = NULL;
#endif
- cipher->sign_protocol = "application/pkcs7-signature";
- cipher->encrypt_protocol = "application/pkcs7-mime";
- cipher->key_protocol = "application/pkcs7-keys";
+ crypto->sign_protocol = "application/pkcs7-signature";
+ crypto->encrypt_protocol = "application/pkcs7-mime";
+ crypto->key_protocol = "application/pkcs7-keys";
}
static void
@@ -178,59 +178,59 @@ g_mime_pkcs7_context_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static GMimeCipherHash
-pkcs7_hash_id (GMimeCipherContext *ctx, const char *hash)
+static GMimeCryptoHash
+pkcs7_hash_id (GMimeCryptoContext *ctx, const char *hash)
{
if (hash == NULL)
- return GMIME_CIPHER_HASH_DEFAULT;
+ return GMIME_CRYPTO_HASH_DEFAULT;
if (!g_ascii_strcasecmp (hash, "md2"))
- return GMIME_CIPHER_HASH_MD2;
+ return GMIME_CRYPTO_HASH_MD2;
else if (!g_ascii_strcasecmp (hash, "md5"))
- return GMIME_CIPHER_HASH_MD5;
+ return GMIME_CRYPTO_HASH_MD5;
else if (!g_ascii_strcasecmp (hash, "sha1"))
- return GMIME_CIPHER_HASH_SHA1;
+ return GMIME_CRYPTO_HASH_SHA1;
else if (!g_ascii_strcasecmp (hash, "sha224"))
- return GMIME_CIPHER_HASH_SHA224;
+ return GMIME_CRYPTO_HASH_SHA224;
else if (!g_ascii_strcasecmp (hash, "sha256"))
- return GMIME_CIPHER_HASH_SHA256;
+ return GMIME_CRYPTO_HASH_SHA256;
else if (!g_ascii_strcasecmp (hash, "sha384"))
- return GMIME_CIPHER_HASH_SHA384;
+ return GMIME_CRYPTO_HASH_SHA384;
else if (!g_ascii_strcasecmp (hash, "sha512"))
- return GMIME_CIPHER_HASH_SHA512;
+ return GMIME_CRYPTO_HASH_SHA512;
else if (!g_ascii_strcasecmp (hash, "ripemd160"))
- return GMIME_CIPHER_HASH_RIPEMD160;
+ return GMIME_CRYPTO_HASH_RIPEMD160;
else if (!g_ascii_strcasecmp (hash, "tiger192"))
- return GMIME_CIPHER_HASH_TIGER192;
+ return GMIME_CRYPTO_HASH_TIGER192;
else if (!g_ascii_strcasecmp (hash, "haval-5-160"))
- return GMIME_CIPHER_HASH_HAVAL5160;
+ return GMIME_CRYPTO_HASH_HAVAL5160;
- return GMIME_CIPHER_HASH_DEFAULT;
+ return GMIME_CRYPTO_HASH_DEFAULT;
}
static const char *
-pkcs7_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
+pkcs7_hash_name (GMimeCryptoContext *ctx, GMimeCryptoHash hash)
{
switch (hash) {
- case GMIME_CIPHER_HASH_MD2:
+ case GMIME_CRYPTO_HASH_MD2:
return "md2";
- case GMIME_CIPHER_HASH_MD5:
+ case GMIME_CRYPTO_HASH_MD5:
return "md5";
- case GMIME_CIPHER_HASH_SHA1:
+ case GMIME_CRYPTO_HASH_SHA1:
return "sha1";
- case GMIME_CIPHER_HASH_SHA224:
+ case GMIME_CRYPTO_HASH_SHA224:
return "sha224";
- case GMIME_CIPHER_HASH_SHA256:
+ case GMIME_CRYPTO_HASH_SHA256:
return "sha256";
- case GMIME_CIPHER_HASH_SHA384:
+ case GMIME_CRYPTO_HASH_SHA384:
return "sha384";
- case GMIME_CIPHER_HASH_SHA512:
+ case GMIME_CRYPTO_HASH_SHA512:
return "sha512";
- case GMIME_CIPHER_HASH_RIPEMD160:
+ case GMIME_CRYPTO_HASH_RIPEMD160:
return "ripemd160";
- case GMIME_CIPHER_HASH_TIGER192:
+ case GMIME_CRYPTO_HASH_TIGER192:
return "tiger192";
- case GMIME_CIPHER_HASH_HAVAL5160:
+ case GMIME_CRYPTO_HASH_HAVAL5160:
return "haval-5-160";
default:
return "sha1";
@@ -241,7 +241,7 @@ pkcs7_hash_name (GMimeCipherContext *ctx, GMimeCipherHash hash)
static gpgme_error_t
pkcs7_passphrase_cb (void *hook, const char *uid_hint, const char *passphrase_info, int prev_was_bad, int fd)
{
- GMimeCipherContext *context = (GMimeCipherContext *) hook;
+ GMimeCryptoContext *context = (GMimeCryptoContext *) hook;
GMimeStream *stream;
gpgme_error_t error;
GError *err = NULL;
@@ -396,7 +396,7 @@ pkcs7_add_signer (Pkcs7Ctx *pkcs7, const char *signer, GError **err)
#endif /* ENABLE_SMIME */
static int
-pkcs7_sign (GMimeCipherContext *context, const char *userid, GMimeCipherHash hash,
+pkcs7_sign (GMimeCryptoContext *context, const char *userid, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_SMIME
@@ -583,7 +583,7 @@ pkcs7_get_validity (Pkcs7Ctx *pkcs7, gboolean verify)
#endif /* ENABLE_SMIME */
static GMimeSignatureValidity *
-pkcs7_verify (GMimeCipherContext *context, GMimeCipherHash hash,
+pkcs7_verify (GMimeCryptoContext *context, GMimeCryptoHash hash,
GMimeStream *istream, GMimeStream *sigstream,
GError **err)
{
@@ -648,7 +648,7 @@ key_list_free (gpgme_key_t *keys)
#endif /* ENABLE_SMIME */
static int
-pkcs7_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
+pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream,
GError **err)
{
@@ -712,7 +712,7 @@ pkcs7_encrypt (GMimeCipherContext *context, gboolean sign, const char *userid,
static GMimeSignatureValidity *
-pkcs7_decrypt (GMimeCipherContext *context, GMimeStream *istream,
+pkcs7_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_SMIME
@@ -753,7 +753,7 @@ pkcs7_decrypt (GMimeCipherContext *context, GMimeStream *istream,
}
static int
-pkcs7_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **err)
+pkcs7_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err)
{
#ifdef ENABLE_SMIME
GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
@@ -784,7 +784,7 @@ pkcs7_import_keys (GMimeCipherContext *context, GMimeStream *istream, GError **e
}
static int
-pkcs7_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
+pkcs7_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_SMIME
GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
@@ -822,15 +822,15 @@ pkcs7_export_keys (GMimeCipherContext *context, GPtrArray *keys, GMimeStream *os
* g_mime_pkcs7_context_new:
* @request_passwd: a #GMimePasswordRequestFunc
*
- * Creates a new pkcs7 cipher context object.
+ * Creates a new pkcs7 crypto context object.
*
- * Returns: a new pkcs7 cipher context object.
+ * Returns: a new pkcs7 crypto context object.
**/
-GMimeCipherContext *
+GMimeCryptoContext *
g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd)
{
#ifdef ENABLE_SMIME
- GMimeCipherContext *cipher;
+ GMimeCryptoContext *crypto;
GMimePkcs7Context *pkcs7;
gpgme_ctx_t ctx;
@@ -847,10 +847,10 @@ g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd)
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
pkcs7->priv->ctx = ctx;
- cipher = (GMimeCipherContext *) pkcs7;
- cipher->request_passwd = request_passwd;
+ crypto = (GMimeCryptoContext *) pkcs7;
+ crypto->request_passwd = request_passwd;
- return cipher;
+ return crypto;
#else
return NULL;
#endif /* ENABLE_SMIME */
diff --git a/gmime/gmime-pkcs7-context.h b/gmime/gmime-pkcs7-context.h
index 1b44983..7525a42 100644
--- a/gmime/gmime-pkcs7-context.h
+++ b/gmime/gmime-pkcs7-context.h
@@ -22,7 +22,7 @@
#ifndef __GMIME_PKCS7_CONTEXT_H__
#define __GMIME_PKCS7_CONTEXT_H__
-#include <gmime/gmime-cipher-context.h>
+#include <gmime/gmime-crypto-context.h>
G_BEGIN_DECLS
@@ -39,26 +39,26 @@ typedef struct _GMimePkcs7ContextClass GMimePkcs7ContextClass;
/**
* GMimePkcs7Context:
- * @parent_object: parent #GMimeCipherContext
+ * @parent_object: parent #GMimeCryptoContext
* @priv: private context data
*
- * A PKCS7 cipher context.
+ * A PKCS7 crypto context.
**/
struct _GMimePkcs7Context {
- GMimeCipherContext parent_object;
+ GMimeCryptoContext parent_object;
struct _GMimePkcs7ContextPrivate *priv;
};
struct _GMimePkcs7ContextClass {
- GMimeCipherContextClass parent_class;
+ GMimeCryptoContextClass parent_class;
};
GType g_mime_pkcs7_context_get_type (void);
-GMimeCipherContext *g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd);
+GMimeCryptoContext *g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd);
gboolean g_mime_pkcs7_context_get_always_trust (GMimePkcs7Context *ctx);
void g_mime_pkcs7_context_set_always_trust (GMimePkcs7Context *ctx, gboolean always_trust);
diff --git a/gmime/gmime.h b/gmime/gmime.h
index f32145f..5ce102f 100644
--- a/gmime/gmime.h
+++ b/gmime/gmime.h
@@ -68,7 +68,7 @@
#include <gmime/gmime-filter-strip.h>
#include <gmime/gmime-filter-windows.h>
#include <gmime/gmime-filter-yenc.h>
-#include <gmime/gmime-cipher-context.h>
+#include <gmime/gmime-crypto-context.h>
#include <gmime/gmime-gpg-context.h>
G_BEGIN_DECLS
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index 7a55ffd..d1bc897 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -39,7 +39,7 @@ extern int verbose;
#define v(x) if (verbose > 3) x
static gboolean
-request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
+request_passwd (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
{
g_mime_stream_write_string (response, "no.secret\n");
@@ -47,14 +47,14 @@ request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt
}
static void
-test_sign (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_sign (GMimeCryptoContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GError *err = NULL;
Exception *ex;
int rv;
- rv = g_mime_cipher_context_sign (ctx, "no user no domain",
- GMIME_CIPHER_HASH_SHA256,
+ rv = g_mime_crypto_context_sign (ctx, "no user no domain",
+ GMIME_CRYPTO_HASH_SHA256,
cleartext, ciphertext, &err);
if (rv == -1 || err != NULL) {
@@ -64,19 +64,19 @@ test_sign (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphert
}
v(fprintf (stderr, "signature (%s):\n%.*s\n",
- g_mime_cipher_context_hash_name (ctx, rv),
+ g_mime_crypto_context_hash_name (ctx, rv),
GMIME_STREAM_MEM (ciphertext)->buffer->len,
GMIME_STREAM_MEM (ciphertext)->buffer->data));
}
static void
-test_verify (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_verify (GMimeCryptoContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GMimeSignatureValidity *validity;
GError *err = NULL;
Exception *ex;
- validity = g_mime_cipher_context_verify (ctx, GMIME_CIPHER_HASH_DEFAULT,
+ validity = g_mime_crypto_context_verify (ctx, GMIME_CRYPTO_HASH_DEFAULT,
cleartext, ciphertext, &err);
if (validity == NULL) {
@@ -94,7 +94,7 @@ test_verify (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphe
}
static void
-test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_encrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GPtrArray *recipients;
GError *err = NULL;
@@ -103,7 +103,7 @@ test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "no user no domain");
- g_mime_cipher_context_encrypt (ctx, sign, "no user no domain", recipients,
+ g_mime_crypto_context_encrypt (ctx, sign, "no user no domain", recipients,
cleartext, ciphertext, &err);
g_ptr_array_free (recipients, TRUE);
@@ -120,7 +120,7 @@ test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
}
static void
-test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_decrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GMimeSignatureValidity *sv;
Exception *ex = NULL;
@@ -130,7 +130,7 @@ test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
stream = g_mime_stream_mem_new ();
- if (!(sv = g_mime_cipher_context_decrypt (ctx, ciphertext, stream, &err))) {
+ if (!(sv = g_mime_crypto_context_decrypt (ctx, ciphertext, stream, &err))) {
g_object_unref (stream);
ex = exception_new ("%s", err->message);
g_error_free (err);
@@ -165,7 +165,7 @@ test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
}
static void
-test_export (GMimeCipherContext *ctx, const char *path)
+test_export (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *istream, *ostream;
register const char *inptr;
@@ -190,7 +190,7 @@ test_export (GMimeCipherContext *ctx, const char *path)
ostream = g_mime_stream_mem_new ();
- g_mime_cipher_context_export_keys (ctx, keys, ostream, &err);
+ g_mime_crypto_context_export_keys (ctx, keys, ostream, &err);
g_ptr_array_free (keys, TRUE);
if (err != NULL) {
ex = exception_new ("%s", err->message);
@@ -229,7 +229,7 @@ test_export (GMimeCipherContext *ctx, const char *path)
}
static void
-import_key (GMimeCipherContext *ctx, const char *path)
+import_key (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *stream;
GError *err = NULL;
@@ -240,7 +240,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
- g_mime_cipher_context_import_keys (ctx, stream, &err);
+ g_mime_crypto_context_import_keys (ctx, stream, &err);
g_object_unref (stream);
if (err != NULL) {
@@ -255,7 +255,7 @@ int main (int argc, char **argv)
{
const char *datadir = "data/pgp";
GMimeStream *istream, *ostream;
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
const char *what;
struct stat st;
char *key;
@@ -281,7 +281,7 @@ int main (int argc, char **argv)
if (i < argc && (stat (datadir, &st) == -1 || !S_ISDIR (st.st_mode)))
return EXIT_FAILURE;
- testsuite_start ("GnuPG cipher context");
+ testsuite_start ("GnuPG crypto context");
ctx = g_mime_gpg_context_new (request_passwd, "/usr/bin/gpg");
g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) ctx, TRUE);
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 181f062..2784e7f 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -40,7 +40,7 @@ extern int verbose;
#define v(x) if (verbose > 3) x
static gboolean
-request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
+request_passwd (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
{
g_mime_stream_write_string (response, "no.secret\n");
@@ -151,7 +151,7 @@ that GMime properly treats MIME part content as opaque.\nIf this still verifies
then we have ourselves a winner I guess...\n"
static void
-test_multipart_signed (GMimeCipherContext *ctx)
+test_multipart_signed (GMimeCryptoContext *ctx)
{
GMimeSignatureValidity *validity;
GMimeMultipartSigned *mps;
@@ -188,7 +188,7 @@ test_multipart_signed (GMimeCipherContext *ctx)
/* sign the part */
g_mime_multipart_signed_sign (mps, GMIME_OBJECT (part), ctx, "no user no domain",
- GMIME_CIPHER_HASH_SHA1, &err);
+ GMIME_CRYPTO_HASH_SHA1, &err);
g_object_unref (part);
if (err != NULL) {
@@ -246,7 +246,7 @@ test_multipart_signed (GMimeCipherContext *ctx)
#define MULTIPART_ENCRYPTED_CONTENT "This is a test of multipart/encrypted.\n"
static void
-test_multipart_encrypted (GMimeCipherContext *ctx, gboolean sign)
+test_multipart_encrypted (GMimeCryptoContext *ctx, gboolean sign)
{
const GMimeSignatureValidity *sv;
GMimeStream *cleartext, *stream;
@@ -370,7 +370,7 @@ test_multipart_encrypted (GMimeCipherContext *ctx, gboolean sign)
}
static void
-import_key (GMimeCipherContext *ctx, const char *path)
+import_key (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *stream;
GError *err = NULL;
@@ -381,7 +381,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
- g_mime_cipher_context_import_keys (ctx, stream, &err);
+ g_mime_crypto_context_import_keys (ctx, stream, &err);
g_object_unref (stream);
if (err != NULL) {
@@ -394,7 +394,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
int main (int argc, char *argv[])
{
const char *datadir = "data/pgpmime";
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
struct stat st;
char *key;
int i;
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 0eb6c1c..a9c69e9 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -40,7 +40,7 @@ extern int verbose;
#define v(x) if (verbose > 3) x
static gboolean
-request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
+request_passwd (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
{
g_mime_stream_write_string (response, "no.secret\n");
@@ -48,14 +48,14 @@ request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt
}
static void
-test_sign (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_sign (GMimeCryptoContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GError *err = NULL;
Exception *ex;
int rv;
- rv = g_mime_cipher_context_sign (ctx, "no user no domain",
- GMIME_CIPHER_HASH_SHA256,
+ rv = g_mime_crypto_context_sign (ctx, "no user no domain",
+ GMIME_CRYPTO_HASH_SHA256,
cleartext, ciphertext, &err);
if (rv == -1 || err != NULL) {
@@ -65,19 +65,19 @@ test_sign (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphert
}
v(fprintf (stderr, "signature (%s):\n%.*s\n",
- g_mime_cipher_context_hash_name (ctx, rv),
+ g_mime_crypto_context_hash_name (ctx, rv),
GMIME_STREAM_MEM (ciphertext)->buffer->len,
GMIME_STREAM_MEM (ciphertext)->buffer->data));
}
static void
-test_verify (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_verify (GMimeCryptoContext *ctx, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GMimeSignatureValidity *validity;
GError *err = NULL;
Exception *ex;
- validity = g_mime_cipher_context_verify (ctx, GMIME_CIPHER_HASH_DEFAULT,
+ validity = g_mime_crypto_context_verify (ctx, GMIME_CRYPTO_HASH_DEFAULT,
cleartext, ciphertext, &err);
if (validity == NULL) {
@@ -95,7 +95,7 @@ test_verify (GMimeCipherContext *ctx, GMimeStream *cleartext, GMimeStream *ciphe
}
static void
-test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_encrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GPtrArray *recipients;
GError *err = NULL;
@@ -104,7 +104,7 @@ test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "no user no domain");
- g_mime_cipher_context_encrypt (ctx, sign, "no user no domain", recipients,
+ g_mime_crypto_context_encrypt (ctx, sign, "no user no domain", recipients,
cleartext, ciphertext, &err);
g_ptr_array_free (recipients, TRUE);
@@ -121,7 +121,7 @@ test_encrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
}
static void
-test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
+test_decrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GMimeStream *ciphertext)
{
GMimeSignatureValidity *sv;
Exception *ex = NULL;
@@ -131,7 +131,7 @@ test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
stream = g_mime_stream_mem_new ();
- if (!(sv = g_mime_cipher_context_decrypt (ctx, ciphertext, stream, &err))) {
+ if (!(sv = g_mime_crypto_context_decrypt (ctx, ciphertext, stream, &err))) {
g_object_unref (stream);
ex = exception_new ("%s", err->message);
g_error_free (err);
@@ -166,7 +166,7 @@ test_decrypt (GMimeCipherContext *ctx, gboolean sign, GMimeStream *cleartext, GM
}
static void
-test_export (GMimeCipherContext *ctx, const char *path)
+test_export (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *istream, *ostream;
register const char *inptr;
@@ -191,7 +191,7 @@ test_export (GMimeCipherContext *ctx, const char *path)
ostream = g_mime_stream_mem_new ();
- g_mime_cipher_context_export_keys (ctx, keys, ostream, &err);
+ g_mime_crypto_context_export_keys (ctx, keys, ostream, &err);
g_ptr_array_free (keys, TRUE);
if (err != NULL) {
ex = exception_new ("%s", err->message);
@@ -230,7 +230,7 @@ test_export (GMimeCipherContext *ctx, const char *path)
}
static void
-import_key (GMimeCipherContext *ctx, const char *path)
+import_key (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *stream;
GError *err = NULL;
@@ -241,7 +241,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
- g_mime_cipher_context_import_keys (ctx, stream, &err);
+ g_mime_crypto_context_import_keys (ctx, stream, &err);
g_object_unref (stream);
if (err != NULL) {
@@ -256,7 +256,7 @@ int main (int argc, char **argv)
{
const char *datadir = "data/pkcs7";
GMimeStream *istream, *ostream;
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
const char *what;
struct stat st;
char *key;
@@ -281,7 +281,7 @@ int main (int argc, char **argv)
if (i < argc && (stat (datadir, &st) == -1 || !S_ISDIR (st.st_mode)))
return EXIT_FAILURE;
- testsuite_start ("Pkcs7 cipher context");
+ testsuite_start ("Pkcs7 crypto context");
ctx = g_mime_pkcs7_context_new (request_passwd);
g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) ctx, TRUE);
diff --git a/tests/test-smime.c b/tests/test-smime.c
index dc888e7..b72f74d 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -41,7 +41,7 @@ extern int verbose;
#define v(x) if (verbose > 3) x
static gboolean
-request_passwd (GMimeCipherContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
+request_passwd (GMimeCryptoContext *ctx, const char *user_id, const char *prompt_ctx, gboolean reprompt, GMimeStream *response, GError **err)
{
g_mime_stream_write_string (response, "no.secret\n");
@@ -152,7 +152,7 @@ that GMime properly treats MIME part content as opaque.\nIf this still verifies
then we have ourselves a winner I guess...\n"
static void
-test_multipart_signed (GMimeCipherContext *ctx)
+test_multipart_signed (GMimeCryptoContext *ctx)
{
GMimeSignatureValidity *validity;
GMimeMultipartSigned *mps;
@@ -189,7 +189,7 @@ test_multipart_signed (GMimeCipherContext *ctx)
/* sign the part */
g_mime_multipart_signed_sign (mps, GMIME_OBJECT (part), ctx, "no user no domain",
- GMIME_CIPHER_HASH_SHA1, &err);
+ GMIME_CRYPTO_HASH_SHA1, &err);
g_object_unref (part);
if (err != NULL) {
@@ -247,7 +247,7 @@ test_multipart_signed (GMimeCipherContext *ctx)
#define MULTIPART_ENCRYPTED_CONTENT "This is a test of multipart/encrypted.\n"
static void
-test_multipart_encrypted (GMimeCipherContext *ctx, gboolean sign)
+test_multipart_encrypted (GMimeCryptoContext *ctx, gboolean sign)
{
const GMimeSignatureValidity *sv;
GMimeStream *cleartext, *stream;
@@ -371,7 +371,7 @@ test_multipart_encrypted (GMimeCipherContext *ctx, gboolean sign)
}
static void
-import_key (GMimeCipherContext *ctx, const char *path)
+import_key (GMimeCryptoContext *ctx, const char *path)
{
GMimeStream *stream;
GError *err = NULL;
@@ -382,7 +382,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
throw (exception_new ("open() failed: %s", g_strerror (errno)));
stream = g_mime_stream_fs_new (fd);
- g_mime_cipher_context_import_keys (ctx, stream, &err);
+ g_mime_crypto_context_import_keys (ctx, stream, &err);
g_object_unref (stream);
if (err != NULL) {
@@ -395,7 +395,7 @@ import_key (GMimeCipherContext *ctx, const char *path)
int main (int argc, char *argv[])
{
const char *datadir = "data/smime";
- GMimeCipherContext *ctx;
+ GMimeCryptoContext *ctx;
struct stat st;
char *key;
int i;
diff --git a/tools/gmime-port-2-4-to-2-6.sh b/tools/gmime-port-2-4-to-2-6.sh
index 86e070e..56792a2 100755
--- a/tools/gmime-port-2-4-to-2-6.sh
+++ b/tools/gmime-port-2-4-to-2-6.sh
@@ -7,6 +7,12 @@ do
-e "s/GMIME_BEST_ENCODING_8BIT/GMIME_ENCODING_CONSTRAINT_8BIT/g" \
-e "s/GMIME_BEST_ENCODING_BINARY/GMIME_ENCODING_CONSTRAINT_BINARY/g" \
-e "s/GMimeBestEncoding/GMimeEncodingConstraint/g" \
+ -e "s/GMimeCipher/GMimeCrypto/g" \
+ -e "s/GMIME_CIPHER_/GMIME_CRYPTO_/g" \
+ -e "s/GMIME_IS_CIPHER_/GMIME_IS_CRYPTO_/g" \
+ -e "s/g_mime_cipher_/g_mime_crypto_/g" \
+ -e "s/gmime-cipher-context.h/gmime-crypto-context.h/g" \
+ -e "s/GMIME_TYPE_CIPHER_CONTEXT/GMIME_TYPE_CRYPTO_CONTEXT/g" \
-e "s/g_mime_signer_get_created/g_mime_signer_get_sig_created/g" \
-e "s/g_mime_signer_set_created/g_mime_signer_set_sig_created/g" \
-e "s/g_mime_signer_get_expires/g_mime_signer_get_sig_expires/g" \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]