diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9d26e50..b588fd0 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -559,6 +559,25 @@ build_message_headers (EMsgComposer *composer,
}
}
+static CamelCipherHash
+account_hash_algo_to_camel_hash (const gchar *hash_algo)
+{
+ CamelCipherHash res = CAMEL_CIPHER_HASH_DEFAULT;
+
+ if (hash_algo && *hash_algo) {
+ if (g_ascii_strcasecmp (hash_algo, "sha1") == 0)
+ res = CAMEL_CIPHER_HASH_SHA1;
+ else if (g_ascii_strcasecmp (hash_algo, "sha256") == 0)
+ res = CAMEL_CIPHER_HASH_SHA256;
+ else if (g_ascii_strcasecmp (hash_algo, "sha384") == 0)
+ res = CAMEL_CIPHER_HASH_SHA384;
+ else if (g_ascii_strcasecmp (hash_algo, "sha512") == 0)
+ res = CAMEL_CIPHER_HASH_SHA512;
+ }
+
+ return res;
+}
+
static CamelMimeMessage *
build_message (EMsgComposer *composer,
gboolean html_content,
@@ -895,7 +914,6 @@ build_message (EMsgComposer *composer,
const gchar *pgp_userid;
CamelInternetAddress *from = NULL;
CamelCipherContext *cipher;
- EAccount *account;
part = camel_mime_part_new ();
camel_medium_set_content (CAMEL_MEDIUM (part), current);
@@ -903,8 +921,6 @@ build_message (EMsgComposer *composer,
camel_mime_part_set_encoding (part, plain_encoding);
g_object_unref (current);
- account = e_composer_header_table_get_account (table);
-
if (account && account->pgp_key && *account->pgp_key) {
pgp_userid = account->pgp_key;
} else {
@@ -921,7 +937,8 @@ build_message (EMsgComposer *composer,
CAMEL_GPG_CONTEXT (cipher),
account->pgp_always_trust);
camel_cipher_sign (
- cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1,
+ cipher, pgp_userid, account_hash_algo_to_camel_hash (
+ account ? e_account_get_string (account, E_ACCOUNT_PGP_HASH_ALGORITHM) : NULL),
part, npart, &ex);
g_object_unref (cipher);
@@ -1009,7 +1026,9 @@ build_message (EMsgComposer *composer,
camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
}
- camel_cipher_sign (cipher, account->smime_sign_key, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
+ camel_cipher_sign (cipher, account->smime_sign_key,
+ account_hash_algo_to_camel_hash (account ? e_account_get_string (account, E_ACCOUNT_SMIME_HASH_ALGORITHM) : NULL),
+ part, npart, &ex);
camel_object_unref (cipher);
if (camel_exception_is_set (&ex)) {
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index e253770..55b7399 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -2775,6 +2775,65 @@ emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
return w;
}
+static void
+emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, EMAccountEditor *emae)
+{
+ EAccount *account;
+ gpointer data;
+ const gchar *text = NULL;
+
+ account = em_account_editor_get_modified_account (emae);
+ data = g_object_get_data (G_OBJECT (combobox), "account-item");
+
+ switch (gtk_combo_box_get_active (combobox)) {
+ case 1: text = "sha1";
+ break;
+ case 2: text = "sha256";
+ break;
+ case 3:
+ text = "sha384";
+ break;
+ case 4:
+ text = "sha512";
+ break;
+ }
+
+ e_account_set_string (account, GPOINTER_TO_INT (data), text);
+}
+
+static GtkComboBox *
+emae_account_hash_algo_combo (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder)
+{
+ EAccount *account;
+ GtkComboBox *combobox;
+ const gchar *text;
+ gint index = 0;
+
+ account = em_account_editor_get_modified_account (emae);
+ combobox = GTK_COMBO_BOX (e_builder_get_widget (builder, name));
+ g_return_val_if_fail (combobox != NULL, NULL);
+
+ text = e_account_get_string (account, item);
+ if (text) {
+ if (g_ascii_strcasecmp (text, "sha1") == 0)
+ index = 1;
+ else if (g_ascii_strcasecmp (text, "sha256") == 0)
+ index = 2;
+ else if (g_ascii_strcasecmp (text, "sha384") == 0)
+ index = 3;
+ else if (g_ascii_strcasecmp (text, "sha512") == 0)
+ index = 4;
+ }
+
+ gtk_combo_box_set_active (combobox, index);
+
+ g_object_set_data (G_OBJECT (combobox), "account-item", GINT_TO_POINTER (item));
+ g_signal_connect (combobox, "changed", G_CALLBACK (emae_account_hash_algo_combo_changed_cb), emae);
+ gtk_widget_set_sensitive (GTK_WIDGET (combobox), e_account_writable (account, item));
+
+ return combobox;
+}
+
static GtkWidget *
emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
@@ -2793,6 +2852,7 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
/* Security */
emae_account_entry (emae, "pgp_key", E_ACCOUNT_PGP_KEY, builder);
+ emae_account_hash_algo_combo (emae, "pgp_hash_algo", E_ACCOUNT_PGP_HASH_ALGORITHM, builder);
emae_account_toggle (emae, "pgp_encrypt_to_self", E_ACCOUNT_PGP_ENCRYPT_TO_SELF, builder);
emae_account_toggle (emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, builder);
emae_account_toggle (emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, builder);
@@ -2806,6 +2866,7 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
g_signal_connect (priv->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), emae);
g_signal_connect (priv->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), emae);
+ emae_account_hash_algo_combo (emae, "smime_hash_algo", E_ACCOUNT_SMIME_HASH_ALGORITHM, builder);
priv->smime_sign_default = emae_account_toggle (emae, "smime_sign_default", E_ACCOUNT_SMIME_SIGN_DEFAULT, builder);
priv->smime_encrypt_key = emae_account_entry (emae, "smime_encrypt_key", E_ACCOUNT_SMIME_ENCRYPT_KEY, builder);
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index e264cfa..d1489be 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -95,6 +95,29 @@
+
@@ -2276,7 +2339,7 @@ For example: "Work" or "Personal"
True
- 6
+ 7
3
12
6
@@ -2301,8 +2364,8 @@ For example: "Work" or "Personal"
1
2
- 5
- 6
+ 6
+ 7
@@ -2317,8 +2380,8 @@ For example: "Work" or "Personal"
3
- 4
- 5
+ 5
+ 6
GTK_FILL
@@ -2334,8 +2397,8 @@ For example: "Work" or "Personal"
3
- 3
- 4
+ 4
+ 5
GTK_FILL
@@ -2361,8 +2424,8 @@ For example: "Work" or "Personal"
3
- 2
- 3
+ 3
+ 4
GTK_FILL
GTK_FILL
6
@@ -2377,8 +2440,8 @@ For example: "Work" or "Personal"
smime_encrypt_key
- 5
- 6
+ 6
+ 7
GTK_FILL
@@ -2502,8 +2565,8 @@ For example: "Work" or "Personal"
2
3
- 5
- 6
+ 6
+ 7
GTK_FILL
GTK_FILL
@@ -2618,6 +2681,49 @@ For example: "Work" or "Personal"
GTK_FILL
+
+
+ True
+ 0
+ Signing _algorithm:
+ True
+ smime_hash_algo
+
+
+ 2
+ 3
+ GTK_FILL
+
+
+
+
+
+ True
+ 0
+ 0.0
+ 0.0
+
+
+ True
+ hash_algo_model
+
+
+
+ 0
+
+
+
+
+
+
+ 1
+ 2
+ 2
+ 3
+ GTK_FILL
+
+
+
1
diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c
index 86f8c5d..1dee4d4 100644
--- a/smime/lib/e-cert.c
+++ b/smime/lib/e-cert.c
@@ -635,6 +635,15 @@ get_oid_text (SECItem *oid, gchar **text)
case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
*text = g_strdup (_("PKCS #1 SHA-1 With RSA Encryption"));
break;
+ case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
+ *text = g_strdup (_("PKCS #1 SHA-256 With RSA Encryption"));
+ break;
+ case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
+ *text = g_strdup (_("PKCS #1 SHA-384 With RSA Encryption"));
+ break;
+ case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
+ *text = g_strdup (_("PKCS #1 SHA-512 With RSA Encryption"));
+ break;
case SEC_OID_AVA_COUNTRY_NAME:
*text = g_strdup ("C");
break;