Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 324785 | Differences between
and this patch

Collapse All | Expand All

(-)a/composer/e-msg-composer.c (-5 / +24 lines)
Lines 559-564 build_message_headers (EMsgComposer *composer, Link Here
559
	}
559
	}
560
}
560
}
561
561
562
static CamelCipherHash
563
account_hash_algo_to_camel_hash (const gchar *hash_algo)
564
{
565
	CamelCipherHash res = CAMEL_CIPHER_HASH_DEFAULT;
566
567
	if (hash_algo && *hash_algo) {
568
		if (g_ascii_strcasecmp (hash_algo, "sha1") == 0)
569
			res = CAMEL_CIPHER_HASH_SHA1;
570
		else if (g_ascii_strcasecmp (hash_algo, "sha256") == 0)
571
			res = CAMEL_CIPHER_HASH_SHA256;
572
		else if (g_ascii_strcasecmp (hash_algo, "sha384") == 0)
573
			res = CAMEL_CIPHER_HASH_SHA384;
574
		else if (g_ascii_strcasecmp (hash_algo, "sha512") == 0)
575
			res = CAMEL_CIPHER_HASH_SHA512;
576
	}
577
578
	return res;
579
}
580
562
static CamelMimeMessage *
581
static CamelMimeMessage *
563
build_message (EMsgComposer *composer,
582
build_message (EMsgComposer *composer,
564
               gboolean html_content,
583
               gboolean html_content,
Lines 895-901 build_message (EMsgComposer *composer, Link Here
895
		const gchar *pgp_userid;
914
		const gchar *pgp_userid;
896
		CamelInternetAddress *from = NULL;
915
		CamelInternetAddress *from = NULL;
897
		CamelCipherContext *cipher;
916
		CamelCipherContext *cipher;
898
		EAccount *account;
899
917
900
		part = camel_mime_part_new ();
918
		part = camel_mime_part_new ();
901
		camel_medium_set_content (CAMEL_MEDIUM (part), current);
919
		camel_medium_set_content (CAMEL_MEDIUM (part), current);
Lines 903-910 build_message (EMsgComposer *composer, Link Here
903
			camel_mime_part_set_encoding (part, plain_encoding);
921
			camel_mime_part_set_encoding (part, plain_encoding);
904
		g_object_unref (current);
922
		g_object_unref (current);
905
923
906
		account = e_composer_header_table_get_account (table);
907
908
		if (account && account->pgp_key && *account->pgp_key) {
924
		if (account && account->pgp_key && *account->pgp_key) {
909
			pgp_userid = account->pgp_key;
925
			pgp_userid = account->pgp_key;
910
		} else {
926
		} else {
Lines 921-927 build_message (EMsgComposer *composer, Link Here
921
					CAMEL_GPG_CONTEXT (cipher),
937
					CAMEL_GPG_CONTEXT (cipher),
922
					account->pgp_always_trust);
938
					account->pgp_always_trust);
923
			camel_cipher_sign (
939
			camel_cipher_sign (
924
				cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1,
940
				cipher, pgp_userid, account_hash_algo_to_camel_hash (
941
				account ? e_account_get_string (account, E_ACCOUNT_PGP_HASH_ALGORITHM) : NULL),
925
				part, npart, &ex);
942
				part, npart, &ex);
926
			g_object_unref (cipher);
943
			g_object_unref (cipher);
927
944
Lines 1009-1015 build_message (EMsgComposer *composer, Link Here
1009
				camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
1026
				camel_smime_context_set_encrypt_key ((CamelSMIMEContext *)cipher, TRUE, account->smime_encrypt_key);
1010
			}
1027
			}
1011
1028
1012
			camel_cipher_sign (cipher, account->smime_sign_key, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
1029
			camel_cipher_sign (cipher, account->smime_sign_key,
1030
				account_hash_algo_to_camel_hash (account ? e_account_get_string (account, E_ACCOUNT_SMIME_HASH_ALGORITHM) : NULL),
1031
				part, npart, &ex);
1013
			camel_object_unref (cipher);
1032
			camel_object_unref (cipher);
1014
1033
1015
			if (camel_exception_is_set (&ex)) {
1034
			if (camel_exception_is_set (&ex)) {
(-)a/mail/em-account-editor.c (+61 lines)
Lines 2775-2780 emae_defaults_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget Link Here
2775
	return w;
2775
	return w;
2776
}
2776
}
2777
2777
2778
static void
2779
emae_account_hash_algo_combo_changed_cb (GtkComboBox *combobox, EMAccountEditor *emae)
2780
{
2781
	EAccount *account;
2782
	gpointer data;
2783
	const gchar *text = NULL;
2784
2785
	account = em_account_editor_get_modified_account (emae);
2786
	data = g_object_get_data (G_OBJECT (combobox), "account-item");
2787
2788
	switch (gtk_combo_box_get_active (combobox)) {
2789
	case 1: text = "sha1";
2790
		break;
2791
	case 2: text = "sha256";
2792
		break;
2793
	case 3:
2794
		text = "sha384";
2795
		break;
2796
	case 4:
2797
		text = "sha512";
2798
		break;
2799
	}
2800
2801
	e_account_set_string (account, GPOINTER_TO_INT (data), text);
2802
}
2803
2804
static GtkComboBox *
2805
emae_account_hash_algo_combo (EMAccountEditor *emae, const gchar *name, gint item, GtkBuilder *builder)
2806
{
2807
	EAccount *account;
2808
	GtkComboBox *combobox;
2809
	const gchar *text;
2810
	gint index = 0;
2811
2812
	account = em_account_editor_get_modified_account (emae);
2813
	combobox = GTK_COMBO_BOX (e_builder_get_widget (builder, name));
2814
	g_return_val_if_fail (combobox != NULL, NULL);
2815
2816
	text = e_account_get_string (account, item);
2817
	if (text) {
2818
		if (g_ascii_strcasecmp (text, "sha1") == 0)
2819
			index = 1;
2820
		else if (g_ascii_strcasecmp (text, "sha256") == 0)
2821
			index = 2;
2822
		else if (g_ascii_strcasecmp (text, "sha384") == 0)
2823
			index = 3;
2824
		else if (g_ascii_strcasecmp (text, "sha512") == 0)
2825
			index = 4;
2826
	}
2827
2828
	gtk_combo_box_set_active (combobox, index);
2829
2830
	g_object_set_data (G_OBJECT (combobox), "account-item", GINT_TO_POINTER (item));
2831
	g_signal_connect (combobox, "changed", G_CALLBACK (emae_account_hash_algo_combo_changed_cb), emae);
2832
	gtk_widget_set_sensitive (GTK_WIDGET (combobox), e_account_writable (account, item));
2833
2834
	return combobox;
2835
}
2836
2778
static GtkWidget *
2837
static GtkWidget *
2779
emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
2838
emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
2780
{
2839
{
Lines 2793-2798 emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget Link Here
2793
2852
2794
	/* Security */
2853
	/* Security */
2795
	emae_account_entry (emae, "pgp_key", E_ACCOUNT_PGP_KEY, builder);
2854
	emae_account_entry (emae, "pgp_key", E_ACCOUNT_PGP_KEY, builder);
2855
	emae_account_hash_algo_combo (emae, "pgp_hash_algo", E_ACCOUNT_PGP_HASH_ALGORITHM, builder);
2796
	emae_account_toggle (emae, "pgp_encrypt_to_self", E_ACCOUNT_PGP_ENCRYPT_TO_SELF, builder);
2856
	emae_account_toggle (emae, "pgp_encrypt_to_self", E_ACCOUNT_PGP_ENCRYPT_TO_SELF, builder);
2797
	emae_account_toggle (emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, builder);
2857
	emae_account_toggle (emae, "pgp_always_sign", E_ACCOUNT_PGP_ALWAYS_SIGN, builder);
2798
	emae_account_toggle (emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, builder);
2858
	emae_account_toggle (emae, "pgp_no_imip_sign", E_ACCOUNT_PGP_NO_IMIP_SIGN, builder);
Lines 2806-2811 emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget Link Here
2806
	g_signal_connect (priv->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), emae);
2866
	g_signal_connect (priv->smime_sign_key_select, "clicked", G_CALLBACK(smime_sign_key_select), emae);
2807
	g_signal_connect (priv->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), emae);
2867
	g_signal_connect (priv->smime_sign_key_clear, "clicked", G_CALLBACK(smime_sign_key_clear), emae);
2808
2868
2869
	emae_account_hash_algo_combo (emae, "smime_hash_algo", E_ACCOUNT_SMIME_HASH_ALGORITHM, builder);
2809
	priv->smime_sign_default = emae_account_toggle (emae, "smime_sign_default", E_ACCOUNT_SMIME_SIGN_DEFAULT, builder);
2870
	priv->smime_sign_default = emae_account_toggle (emae, "smime_sign_default", E_ACCOUNT_SMIME_SIGN_DEFAULT, builder);
2810
2871
2811
	priv->smime_encrypt_key = emae_account_entry (emae, "smime_encrypt_key", E_ACCOUNT_SMIME_ENCRYPT_KEY, builder);
2872
	priv->smime_encrypt_key = emae_account_entry (emae, "smime_encrypt_key", E_ACCOUNT_SMIME_ENCRYPT_KEY, builder);
(-)a/mail/mail-config.ui (-16 / +122 lines)
Lines 95-100 Link Here
95
      </row>
95
      </row>
96
    </data>
96
    </data>
97
  </object>
97
  </object>
98
  <object class="GtkListStore" id="hash_algo_model">
99
    <columns>
100
      <!-- column-name Hash Algo Name -->
101
      <column type="gchararray"/>
102
    </columns>
103
    <data>
104
      <row>
105
        <col id="0" translatable="yes">Default</col>
106
      </row>
107
      <row>
108
        <col id="0" translatable="yes">SHA1</col>
109
      </row>
110
      <row>
111
        <col id="0" translatable="yes">SHA256</col>
112
      </row>
113
      <row>
114
        <col id="0" translatable="yes">SHA384</col>
115
      </row>
116
      <row>
117
        <col id="0" translatable="yes">SHA512</col>
118
      </row>
119
    </data>
120
  </object>
98
  <object class="GtkVBox" id="vboxIdentityBorder">
121
  <object class="GtkVBox" id="vboxIdentityBorder">
99
    <property name="visible">True</property>
122
    <property name="visible">True</property>
100
    <property name="border_width">12</property>
123
    <property name="border_width">12</property>
Lines 2174-2179 For example: "Work" or "Personal"</property> Link Here
2174
                        <property name="position">0</property>
2197
                        <property name="position">0</property>
2175
                      </packing>
2198
                      </packing>
2176
                    </child>
2199
                    </child>
2200
                     <child>
2201
                      <object class="GtkHBox" id="hbox4">
2202
                        <property name="visible">True</property>
2203
                        <property name="spacing">12</property>
2204
                        <child>
2205
                          <object class="GtkLabel" id="pgp_hash_algo_label">
2206
                            <property name="visible">True</property>
2207
                            <property name="xalign">0</property>
2208
                            <property name="label" translatable="yes">Si_gning algorithm:</property>
2209
                            <property name="use_underline">True</property>
2210
                            <property name="mnemonic_widget">pgp_hash_algo</property>
2211
                          </object>
2212
                          <packing>
2213
                            <property name="expand">False</property>
2214
                            <property name="fill">False</property>
2215
                            <property name="position">0</property>
2216
                          </packing>
2217
                        </child>
2218
                        <child>
2219
                          <object class="GtkComboBox" id="pgp_hash_algo">
2220
                            <property name="visible">True</property>
2221
                            <property name="model">hash_algo_model</property>
2222
                            <child>
2223
                              <object class="GtkCellRendererText" id="pgp_hash_algo_renderer"/>
2224
                              <attributes>
2225
                                <attribute name="text">0</attribute>
2226
                              </attributes>
2227
                            </child>
2228
                          </object>
2229
                          <packing>
2230
                            <property name="expand">False</property>
2231
                            <property name="fill">False</property>
2232
                            <property name="position">1</property>
2233
                          </packing>
2234
                        </child>
2235
                      </object>
2236
                      <packing>
2237
                        <property name="position">1</property>
2238
                      </packing>
2239
                    </child>
2177
                    <child>
2240
                    <child>
2178
                      <object class="GtkCheckButton" id="pgp_always_sign">
2241
                      <object class="GtkCheckButton" id="pgp_always_sign">
2179
                        <property name="label" translatable="yes">Al_ways sign outgoing messages when using this account</property>
2242
                        <property name="label" translatable="yes">Al_ways sign outgoing messages when using this account</property>
Lines 2186-2192 For example: "Work" or "Personal"</property> Link Here
2186
                      <packing>
2249
                      <packing>
2187
                        <property name="expand">False</property>
2250
                        <property name="expand">False</property>
2188
                        <property name="fill">False</property>
2251
                        <property name="fill">False</property>
2189
                        <property name="position">1</property>
2252
                        <property name="position">2</property>
2190
                      </packing>
2253
                      </packing>
2191
                    </child>
2254
                    </child>
2192
                    <child>
2255
                    <child>
Lines 2202-2208 For example: "Work" or "Personal"</property> Link Here
2202
                      <packing>
2265
                      <packing>
2203
                        <property name="expand">False</property>
2266
                        <property name="expand">False</property>
2204
                        <property name="fill">False</property>
2267
                        <property name="fill">False</property>
2205
                        <property name="position">2</property>
2268
                        <property name="position">3</property>
2206
                      </packing>
2269
                      </packing>
2207
                    </child>
2270
                    </child>
2208
                    <child>
2271
                    <child>
Lines 2217-2223 For example: "Work" or "Personal"</property> Link Here
2217
                      <packing>
2280
                      <packing>
2218
                        <property name="expand">False</property>
2281
                        <property name="expand">False</property>
2219
                        <property name="fill">False</property>
2282
                        <property name="fill">False</property>
2220
                        <property name="position">3</property>
2283
                        <property name="position">4</property>
2221
                      </packing>
2284
                      </packing>
2222
                    </child>
2285
                    </child>
2223
                  </object>
2286
                  </object>
Lines 2276-2282 For example: "Work" or "Personal"</property> Link Here
2276
            <child>
2339
            <child>
2277
              <object class="GtkTable" id="smime_table">
2340
              <object class="GtkTable" id="smime_table">
2278
                <property name="visible">True</property>
2341
                <property name="visible">True</property>
2279
                <property name="n_rows">6</property>
2342
                <property name="n_rows">7</property>
2280
                <property name="n_columns">3</property>
2343
                <property name="n_columns">3</property>
2281
                <property name="column_spacing">12</property>
2344
                <property name="column_spacing">12</property>
2282
                <property name="row_spacing">6</property>
2345
                <property name="row_spacing">6</property>
Lines 2301-2308 For example: "Work" or "Personal"</property> Link Here
2301
                  <packing>
2364
                  <packing>
2302
                    <property name="left_attach">1</property>
2365
                    <property name="left_attach">1</property>
2303
                    <property name="right_attach">2</property>
2366
                    <property name="right_attach">2</property>
2304
                    <property name="top_attach">5</property>
2367
                    <property name="top_attach">6</property>
2305
                    <property name="bottom_attach">6</property>
2368
                    <property name="bottom_attach">7</property>
2306
                    <property name="y_options"></property>
2369
                    <property name="y_options"></property>
2307
                  </packing>
2370
                  </packing>
2308
                </child>
2371
                </child>
Lines 2317-2324 For example: "Work" or "Personal"</property> Link Here
2317
                  </object>
2380
                  </object>
2318
                  <packing>
2381
                  <packing>
2319
                    <property name="right_attach">3</property>
2382
                    <property name="right_attach">3</property>
2320
                    <property name="top_attach">4</property>
2383
                    <property name="top_attach">5</property>
2321
                    <property name="bottom_attach">5</property>
2384
                    <property name="bottom_attach">6</property>
2322
                    <property name="x_options">GTK_FILL</property>
2385
                    <property name="x_options">GTK_FILL</property>
2323
                    <property name="y_options"></property>
2386
                    <property name="y_options"></property>
2324
                  </packing>
2387
                  </packing>
Lines 2334-2341 For example: "Work" or "Personal"</property> Link Here
2334
                  </object>
2397
                  </object>
2335
                  <packing>
2398
                  <packing>
2336
                    <property name="right_attach">3</property>
2399
                    <property name="right_attach">3</property>
2337
                    <property name="top_attach">3</property>
2400
                    <property name="top_attach">4</property>
2338
                    <property name="bottom_attach">4</property>
2401
                    <property name="bottom_attach">5</property>
2339
                    <property name="x_options">GTK_FILL</property>
2402
                    <property name="x_options">GTK_FILL</property>
2340
                    <property name="y_options"></property>
2403
                    <property name="y_options"></property>
2341
                  </packing>
2404
                  </packing>
Lines 2361-2368 For example: "Work" or "Personal"</property> Link Here
2361
                  </object>
2424
                  </object>
2362
                  <packing>
2425
                  <packing>
2363
                    <property name="right_attach">3</property>
2426
                    <property name="right_attach">3</property>
2364
                    <property name="top_attach">2</property>
2427
                    <property name="top_attach">3</property>
2365
                    <property name="bottom_attach">3</property>
2428
                    <property name="bottom_attach">4</property>
2366
                    <property name="x_options">GTK_FILL</property>
2429
                    <property name="x_options">GTK_FILL</property>
2367
                    <property name="y_options">GTK_FILL</property>
2430
                    <property name="y_options">GTK_FILL</property>
2368
                    <property name="y_padding">6</property>
2431
                    <property name="y_padding">6</property>
Lines 2377-2384 For example: "Work" or "Personal"</property> Link Here
2377
                    <property name="mnemonic_widget">smime_encrypt_key</property>
2440
                    <property name="mnemonic_widget">smime_encrypt_key</property>
2378
                  </object>
2441
                  </object>
2379
                  <packing>
2442
                  <packing>
2380
                    <property name="top_attach">5</property>
2443
                    <property name="top_attach">6</property>
2381
                    <property name="bottom_attach">6</property>
2444
                    <property name="bottom_attach">7</property>
2382
                    <property name="x_options">GTK_FILL</property>
2445
                    <property name="x_options">GTK_FILL</property>
2383
                    <property name="y_options"></property>
2446
                    <property name="y_options"></property>
2384
                  </packing>
2447
                  </packing>
Lines 2502-2509 For example: "Work" or "Personal"</property> Link Here
2502
                  <packing>
2565
                  <packing>
2503
                    <property name="left_attach">2</property>
2566
                    <property name="left_attach">2</property>
2504
                    <property name="right_attach">3</property>
2567
                    <property name="right_attach">3</property>
2505
                    <property name="top_attach">5</property>
2568
                    <property name="top_attach">6</property>
2506
                    <property name="bottom_attach">6</property>
2569
                    <property name="bottom_attach">7</property>
2507
                    <property name="x_options">GTK_FILL</property>
2570
                    <property name="x_options">GTK_FILL</property>
2508
                    <property name="y_options">GTK_FILL</property>
2571
                    <property name="y_options">GTK_FILL</property>
2509
                  </packing>
2572
                  </packing>
Lines 2618-2623 For example: "Work" or "Personal"</property> Link Here
2618
                    <property name="y_options">GTK_FILL</property>
2681
                    <property name="y_options">GTK_FILL</property>
2619
                  </packing>
2682
                  </packing>
2620
                </child>
2683
                </child>
2684
                <child>
2685
                  <object class="GtkLabel" id="smime_hash_algo_label">
2686
                    <property name="visible">True</property>
2687
                    <property name="xalign">0</property>
2688
                    <property name="label" translatable="yes">Signing _algorithm:</property>
2689
                    <property name="use_underline">True</property>
2690
                    <property name="mnemonic_widget">smime_hash_algo</property>
2691
                  </object>
2692
                  <packing>
2693
                    <property name="top_attach">2</property>
2694
                    <property name="bottom_attach">3</property>
2695
                    <property name="x_options">GTK_FILL</property>
2696
                    <property name="y_options"></property>
2697
                  </packing>
2698
                </child>
2699
                <child>
2700
                  <object class="GtkAlignment" id="smime_hash_algo_alignment">
2701
                    <property name="visible">True</property>
2702
                    <property name="left_padding">0</property>
2703
                    <property name="xalign">0.0</property>
2704
                    <property name="xscale">0.0</property>
2705
                    <child>
2706
                      <object class="GtkComboBox" id="smime_hash_algo">
2707
                        <property name="visible">True</property>
2708
                        <property name="model">hash_algo_model</property>
2709
                        <child>
2710
                          <object class="GtkCellRendererText" id="smime_hash_algo_renderer"/>
2711
                          <attributes>
2712
                            <attribute name="text">0</attribute>
2713
                          </attributes>
2714
                        </child>
2715
                      </object>
2716
                    </child>
2717
                  </object>
2718
                  <packing>
2719
                    <property name="left_attach">1</property>
2720
                    <property name="right_attach">2</property>
2721
                    <property name="top_attach">2</property>
2722
                    <property name="bottom_attach">3</property>
2723
                    <property name="x_options">GTK_FILL</property>
2724
                    <property name="y_options"></property>
2725
                  </packing>
2726
                </child>
2621
              </object>
2727
              </object>
2622
              <packing>
2728
              <packing>
2623
                <property name="position">1</property>
2729
                <property name="position">1</property>
(-)a/smime/lib/e-cert.c (+9 lines)
Lines 635-640 get_oid_text (SECItem *oid, gchar **text) Link Here
635
	case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
635
	case SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION:
636
		*text = g_strdup (_("PKCS #1 SHA-1 With RSA Encryption"));
636
		*text = g_strdup (_("PKCS #1 SHA-1 With RSA Encryption"));
637
		break;
637
		break;
638
	case SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION:
639
		*text = g_strdup (_("PKCS #1 SHA-256 With RSA Encryption"));
640
		break;
641
	case SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION:
642
		*text = g_strdup (_("PKCS #1 SHA-384 With RSA Encryption"));
643
		break;
644
	case SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION:
645
		*text = g_strdup (_("PKCS #1 SHA-512 With RSA Encryption"));
646
		break;
638
	case SEC_OID_AVA_COUNTRY_NAME:
647
	case SEC_OID_AVA_COUNTRY_NAME:
639
		*text = g_strdup ("C");
648
		*text = g_strdup ("C");
640
		break;
649
		break;

Return to bug 324785