Difference between revisions of "S/MIME howto"

From Claws Mail FAQ
Jump to: navigation, search
m (Working with Claws Mail S/MIME and problems/bugs)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
==Claws Mail & S/MIME plugin howto==
 +
This howto describes configuring S/MIME for Claws Mail which uses GnuPG. It is
 +
based on Gentoo Linux but should be working fine on every other distribution if
 +
adjusting it accordingly.
 +
<br />
  
[http://www.squidoo.com/design-and-construction-tips For people located in Weston who might be seeking Home Remodeling Contractor]
+
As of 16th November 2009 Thawte discontinued their free S/MIME certificates. As
 +
some things of this howto were also somewhat out of date and many things were
 +
based on Thawte, it's time for an update. A big difference to the previous howto
 +
is enabling the use of certificate revocation lists (CRL) which didn't work
 +
properly with Thawte before. I won't use OCSP support because of privacy issues,
 +
see man dirmngr.
  
http://www.squidoo.com/design-and-construction-tips
+
===Requirements===
 +
# recent Claws Mail version, recommended: latest available version (v3.7.3 at the time of writing this), because many fixes for S/MIME have been incorporated lately
 +
# most recent S/MIME plugin/package, or "smime" USE flag on Gentoo
 +
# S/MIME certificate (e.g. you can get free (personal use) certificates from Comodo at http://www.instantssl.com)
 +
# pinentry, gnupg, gpgme, dirmngr (for CRL support), ca-certificates (and openssl) in recent versions
 +
# gpg-agent
 +
<br />
 +
I've tested this howto with the following package versions:
 +
<br />
 +
# emerge -p pinentry gnupg gpgme ca-certificates dirmngr claws-mail
 +
    [ebuild  R  ] app-crypt/pinentry-0.7.6  USE="gtk ncurses qt3 qt4 -caps -static" 464 kB
 +
    [ebuild  R  ] app-misc/ca-certificates-20090709  151 kB
 +
    [ebuild  R  ] app-crypt/dirmngr-1.0.3  USE="nls" 544 kB
 +
    [ebuild  R  ] app-crypt/gnupg-2.0.13  USE="bzip2 ldap nls smartcard -adns -caps -doc -openct -pcsc-lite (-selinux) -static" 3,855 kB
 +
    [ebuild  R  ] app-crypt/gpgme-1.1.6  USE="-pth" 1,061 kB
 +
    [ebuild  R  ] mail-client/claws-mail-3.7.3  USE="bogofilter crypt dbus dillo gnome gnutls imap ipv6 kde ldap nntp session smime spamassassin ssl xface -doc -pda -spell -startup-notification" 0 kB
  
Brookline MA
+
===Configuring & running the GPG agent===
 +
Claws Mail depends on a running gpg-agent for using any S/MIME feature. Furthermore
 +
it is used to cache the passphrase. A gpg-agent will need a pinentry
 +
application to ask for the pin.
  
New England architecture has distinctive design aspects not all architects are familiar with. For that explanation, be really selective when hiring an architectural company to build your New Hampshire or New England
+
<br />
 +
Configuration file: "$HOME/.gnupg/gpg-agent.conf" (adjust the paths accordingly)
 +
<br />
 +
pinentry-program /usr/bin/pinentry-qt
 +
default-cache-ttl 86400  # be aware that the passphrases will be cached for 86400 seconds! set accordingly to your needs
 +
max-cache-ttl 86400
 +
disable-scdaemon
 +
write-env-file ~/.gnupg/.gpg-agent-info
 +
allow-mark-trusted
 +
keep-display
 +
display :0.0
 +
debug-level basic
 +
<br />
  
This is definitely not a total listing but some things to think about.
+
Running gpg-agent is quite trivial:
  
1. Ask friends, relatives, company associates and coworkers for suggestions. You can easily additionally instigate an on-line search for trustworthy, neighborhood architects.
+
eval `gpg-agent --daemon`
  
2. Go with your list of candidates and determine which architects are the most accredited. Examine for experience, but additionally exactly how long they have been making common new Hampshire-style residential buildings.
+
As you see, it eval's the command, that means, gpg-agent returns an environment
 +
variable and exports it, something like `GPG_AGENT_INFO=xxx; export
 +
GPG_AGENT_INFO`. This means, that you will have to run claws-mail from the same
 +
session, because it will need this environment variable in order to access the
 +
agent. Check gpg-agent(1) for more details on the usual startup customs.
  
3. Start contact meetings with your professionals in New Hampshire architecture.
+
====KDE Users====
 +
KDE has a way to run scripts and thus export environment variables at startup
 +
time. Every application running in this session will get access to these variables. All
 +
you have to do is create a file under the directory ~/.kde/env/ (if it doesn't
 +
exist, then create it). I named it gpgagent.sh, the content of this shell script
 +
is quite trivial (don't forget to chmod +x):
  
4. Prepare a listing of questions regarding the firm, the team, and how they plan to manage your project. Talk about charges, and the time they need to complete your request. Take lots of notes.
+
#!/bin/sh
 +
eval `gpg-agent --daemon`
  
Compare all the solutions you got from the architects you interviewed. Not just consider the talks you had, but also about your general impression. Was the architect friendly?
+
Also create the directory ~/.kde/shutdown/ and place another shell script in it
 +
(e.g. again gpgagent.sh) with the following contents:
 +
#!/bin/sh
 +
# the second field of the GPG_AGENT_INFO variable is the
 +
# process ID of the gpg-agent active in the current session
 +
# so we'll just kill that, rather than all of them :)
 +
[ -n "${GPG_AGENT_INFO}" ] && kill `echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2`
  
6. Based on your investigation, select your professional in New Hampshire architecture. Make sure they is readily available.
 
  
Completely evaluate any type of agreements your architect presents. Thoroughly assess any sort of agreements your architect presents. Take the contract to an attorney for approval.
+
====Optional====
Follow these simple guidelines, and you will certainly be able to discover the very best feasible architect for your project!
+
You can also use keychain, ~/.xsession startup, or any other method to start
 +
gpg-agent. Choose what you like, here are somes howtos:
 +
<br />
 +
http://www.funtoo.org/en/security/keychain/intro/<br />
 +
http://www.gentoo-wiki.info/HOWTO_KMail_gpg-agent_kde#Setting_up_gpg-agent_with_keychain<br />
 +
http://www.claws-mail.org/faq/index.php/Plugins#How_do_I_configure_gpg-agent_and_the_PGP_plugin.3F <br />
 +
man gpg-agent, section DESCRIPTION
  
REDESIGN
 
  
Some things to consider when look at your redesigning kitchen or cooking area include:
+
===Importing S/MIME certificates into gpgsm===
 +
Regardless whether you have obtained your S/MIME certificate in Mozilla Firefox
 +
or another browser, you have to export/backup it to a PKCS12 (.p12) file
 +
somewhere on your disk. I'm using the filename "certbundle.p12" for this howto,
 +
you can call it as you wish (e.g. $emailaddress_$certdate.p12)
  
Consist of the economy and housing market economic climate a real estate turmoil, home remodeling has become residence renovation popular than ever beforeProminent When you decide on to remodel, you can basically build the residence that you've constantly dreamed of without having to worry about the sale of your house, locating the right house, paying closing prices, a down payment and every little thing else that goes with the purchase and sale of a residence. When you pick to upgrade, you can basically build the home that you have actually constantly dreamed of without having to stress about the sale of your residence, finding the right house, paying closing costs, a down repayment and every thing else that goes with the acquisition and sale of a house.
+
Current versions of GnuPG support importing PKCS12 files directly, there's no
 +
need to use openssl anymore, as described in the previous howto. (If it doesn't
 +
work for you, you can still view the old howto through the history and use
 +
openssl to extract and convert the keys). Gpg-agent has to be properly setup and
 +
running by now.
 +
<br />
 +
$ gpgsm --import certbundle.p12
 +
<br />
 +
You will be asked to enter your passphrase for the backup file in the pinentry
 +
popup and you then have choose another passphrase for importing it to gpgsm.
 +
This passphrase will be the one you have to enter everytime you want to decrypt
 +
or sign emails (of course there's the possibility to cache the passphrase).
  
RENOVATION
+
Now one has to add the issuer certificates (CA + intermediate CA) into gpgsm if
 +
they are not already there. The following command will add more than 100 CA certificates
 +
from the ca-certificates package, but you could also only add the specific CA's
 +
for your certificate if you want.
 +
<br />
 +
$ gpgsm --import /usr/share/ca-certificates/mozilla/*
  
Some things to consider when given your upgrading kitchen or home includeResidence
+
Check if your key has been added:<br />
 +
$ gpgsm --list-secret-keys
  
Consist of the economy and housing market economic situation a real estate turmoil, home remodeling chaos become much more has actually come to be ever before. When you decide on to upgrade, you can essentially build the house that you have actually constantly dreamed of without having to fret about the sale of your house, discovering the right house, paying closing prices, a down repayment and everything else that goes with the purchase and sale of a residence. [http://www.squidoo.com/design-and-construction-tips this link]
+
 
 +
===Configuring GnuPG S/MIME===
 +
You'll now have to properly configure GnuPG for S/MIME. As opposed to the
 +
previous howto, we'll also be using certificate revocation list (CRL) support with dirmngr to
 +
be able to detect revoked certificates within the mail client. (It didn't work
 +
before because Thawte has some messed up CRL which GnuPG couldn't handle
 +
properly - but because Thawte doesn't provide S/MIME anymore, we're fine now :)
 +
We only have to import the large Thawte CRL once as all of their certificates
 +
have been revoked.
 +
<br />
 +
 
 +
This is my "$HOME/.gnupg/gpgsm.conf":<br />
 +
disable-policy-checks
 +
auto-issuer-key-retrieve
 +
include-certs -1  # this will include all certificates in the chain up to the root
 +
debug-level basic
 +
<br />
 +
You will also probably want to enter the following entry to gpgsm.conf ( use
 +
the fingerprint output from the command "gpgsm --list-secret-keys")
 +
default-key  fingerprint_of_your_key
 +
 
 +
<br />
 +
My "$HOME/.gnupg/dirmngr.conf" file only contains the following line, everything
 +
is set to default. Dirmngr will be used for CRL support internally by GnuPG. It
 +
is also possible to setup a system-wide dirmngr daemon which is not part of this
 +
howto (see man page).
 +
debug-level basic
 +
<br />
 +
If you encounter any problems with CRL support you can use the old
 +
configuration files from the history in this wiki which disables it. Be aware
 +
that by having imported all CA's dirmngr might encounter a CRL where it can't
 +
fetch it properly and hangs (sometimes happens to me when starting kleopatra).
 +
 
 +
====Importing Thawte CRL and testing CRL support====
 +
As of 16th November 2009 all Thawte S/MIME certificates have been revoked. As
 +
dirmngr doesn't automatically work with the Thawte CRL, one has to import them
 +
manually once. A working gpg-agent setup is again needed, then perform the
 +
following steps:
 +
# download the Thawte CRL
 +
wget http://crl.thawte.com/ThawtePersonalFreemailCA.crl
 +
wget http://crl.thawte.com/ThawtePersonalFreemailIssuingCA.crl
 +
 +
# import to dirmngr
 +
gpgsm --call-dirmngr loadcrl ThawtePersonalFreemailCA.crl
 +
gpgsm --call-dirmngr loadcrl ThawtePersonalFreemailIssuingCA.crl
 +
<br />
 +
If you have old Thawte certificates that are still valid according to their
 +
expiry date or other revoked certificates you can verify that dirmngr works with
 +
the following command:
 +
gpgsm --list-keys --with-validation <keyid|name|fingerprint>
 +
<br />
 +
The output will be like this:
 +
  [...]
 +
  validity: 2009-03-24 08:26:26 through 2010-03-24 08:26:26
 +
  key type: 2048 bit RSA
 +
  fingerprint: xxxx
 +
  [certificate has been revoked]
 +
  [validation model used: shell]
 +
  [certificate is bad: Certificate revoked]
 +
 
 +
See "[certificate is bad: Certificate revoked]" message instead of
 +
"[certificate is good]".
 +
 
 +
====Setting up the trust====
 +
We used the option "allow-mark-trusted" in gpg-agent.conf which allows the
 +
client to mark keys as trusted, i.e. put them in the file
 +
$HOME/.gnupg/trustlist.txt (see man gpg-agent). Hence you should be asked
 +
automatically to trust another key or CA, e.g. it mainly happens for me when I
 +
click on an email in Claws Mail where the CA is missing from trustlist.txt or
 +
when I start the tool "kleopatra" where I'm asked to trust the CAs.
 +
<br />
 +
 
 +
If it doesn't work for you automatically you have to create the file (if it
 +
doesn't exist) "$HOME/.gnupg/trustlist.txt" to add your CA (e.g. Comodo, Thawte)
 +
to the trusted key list. This makes it possible to verify/sign/.../ with your
 +
personal certificate. I also added my own certificate to the trustlist.
 +
<br />
 +
 
 +
Usually one adds the SHA1 fingerprints to the file (not the serial number, and
 +
it doesn't matter whether with or without the colon). With
 +
the following command (borrowed and adjusted from this German howto
 +
http://www.kire.ch/blog/2009/05/07/claws-mail-und-smime-verschlusselung-mit-cacert-zertifikat/)
 +
you can add all your CA's and keys at once (of course you have to trust all the CA's of
 +
the ca-certificate package - if you don't then you have to manually dump the
 +
certificate chain and add the fingerprints accordingly):
 +
<br />
 +
gpgsm --list-keys 2>/dev/null | grep fingerprint | awk '{print $2 " S"}' >> ~/.gnupg/trustlist.txt
 +
(the command will append, not overwrite the old file)
 +
<br />
 +
Note that when manually changing trustlist.txt or gpg-agent.conf, you need to give
 +
gpg-agent a SIGHUP.
 +
<br />
 +
 
 +
===Setting up Claws Mail itself===
 +
There's not much you have to configure in Claws Mail. Go to the menu "Configuration - Edit Accounts | choose your account | - Edit - Account - Privacy - Default privacy system" => S-MIME
 +
<br />
 +
Set the options to your need, e.g. I've set all but the last (Save sent encrypted as clear text).
 +
<br />
 +
As we have configured gpgsm to use a "default key" you can set "Use default GnuPG key" in the Account preferences Plugins/GPG menu.
 +
 
 +
===Working with Claws Mail S/MIME and problems/bugs===
 +
* If you receive the error message "The signature can't be checked - Unknown IPC Command" and you're using "seahorse-agent" try to switch to the gpg-agent of the GnuPG package.
 +
 
 +
* Error message "Cannot sign: General error" usually means that there's something wrong with the gpg-agent (e.g. not running or wrong environment)
 +
 
 +
* If you're an old Thawte user trying to use their offer for a free VeriSign S/MIME certificate with Claws Mail, you're out of luck because GnuPG doesn't support the ancient MD2 algorithm being used by VeriSign for their CA. I've tried getting it to work but never succeeded (except by using Thunderbird), here's a statement from the developer of GnuPG/libgcrypt: http://lists.gnupg.org/pipermail/gpa-dev/2003-October/001482.html
 +
 
 +
* I'm only aware of one problem in Claws Mail, where you'll get "Bad signature" warnings, when you forward (via CM) a signed+encrypted email with an attachment and sign+encrypt the email itself again too.
 +
 
 +
* Error message: Couldn't decrypt: "unsupported algorithm" - this happens when you receive an email which got encrypted with the RC2 algorithm (e.g. some Outlook and some Thunderbird MUAs). I'm currently not aware of a solution on your side, as the underlying libgcrypt doesn't handle it for patent reasons. (see https://intevation.de/roundup/aegypten/issue11 and http://forums.mozillazine.org/viewtopic.php?p=2858116 ) You can ask your email partner to reconfigure their clients though (I know that it works for recent Outlook versions on >=Windows Vista to force certain algorithms).

Latest revision as of 19:24, 7 February 2013

Contents

Claws Mail & S/MIME plugin howto

This howto describes configuring S/MIME for Claws Mail which uses GnuPG. It is based on Gentoo Linux but should be working fine on every other distribution if adjusting it accordingly.

As of 16th November 2009 Thawte discontinued their free S/MIME certificates. As some things of this howto were also somewhat out of date and many things were based on Thawte, it's time for an update. A big difference to the previous howto is enabling the use of certificate revocation lists (CRL) which didn't work properly with Thawte before. I won't use OCSP support because of privacy issues, see man dirmngr.

Requirements

  1. recent Claws Mail version, recommended: latest available version (v3.7.3 at the time of writing this), because many fixes for S/MIME have been incorporated lately
  2. most recent S/MIME plugin/package, or "smime" USE flag on Gentoo
  3. S/MIME certificate (e.g. you can get free (personal use) certificates from Comodo at http://www.instantssl.com)
  4. pinentry, gnupg, gpgme, dirmngr (for CRL support), ca-certificates (and openssl) in recent versions
  5. gpg-agent


I've tested this howto with the following package versions:

# emerge -p pinentry gnupg gpgme ca-certificates dirmngr claws-mail
   [ebuild   R   ] app-crypt/pinentry-0.7.6  USE="gtk ncurses qt3 qt4 -caps -static" 464 kB
   [ebuild   R   ] app-misc/ca-certificates-20090709  151 kB
   [ebuild   R   ] app-crypt/dirmngr-1.0.3  USE="nls" 544 kB
   [ebuild   R   ] app-crypt/gnupg-2.0.13  USE="bzip2 ldap nls smartcard -adns -caps -doc -openct -pcsc-lite (-selinux) -static" 3,855 kB
   [ebuild   R   ] app-crypt/gpgme-1.1.6  USE="-pth" 1,061 kB
   [ebuild   R   ] mail-client/claws-mail-3.7.3  USE="bogofilter crypt dbus dillo gnome gnutls imap ipv6 kde ldap nntp session smime spamassassin ssl xface -doc -pda -spell -startup-notification" 0 kB

Configuring & running the GPG agent

Claws Mail depends on a running gpg-agent for using any S/MIME feature. Furthermore it is used to cache the passphrase. A gpg-agent will need a pinentry application to ask for the pin.


Configuration file: "$HOME/.gnupg/gpg-agent.conf" (adjust the paths accordingly)

pinentry-program /usr/bin/pinentry-qt
default-cache-ttl 86400   # be aware that the passphrases will be cached for 86400 seconds! set accordingly to your needs
max-cache-ttl 86400
disable-scdaemon
write-env-file ~/.gnupg/.gpg-agent-info
allow-mark-trusted
keep-display
display :0.0
debug-level basic


Running gpg-agent is quite trivial:

eval `gpg-agent --daemon`

As you see, it eval's the command, that means, gpg-agent returns an environment variable and exports it, something like `GPG_AGENT_INFO=xxx; export GPG_AGENT_INFO`. This means, that you will have to run claws-mail from the same session, because it will need this environment variable in order to access the agent. Check gpg-agent(1) for more details on the usual startup customs.

KDE Users

KDE has a way to run scripts and thus export environment variables at startup time. Every application running in this session will get access to these variables. All you have to do is create a file under the directory ~/.kde/env/ (if it doesn't exist, then create it). I named it gpgagent.sh, the content of this shell script is quite trivial (don't forget to chmod +x):

#!/bin/sh
eval `gpg-agent --daemon`

Also create the directory ~/.kde/shutdown/ and place another shell script in it (e.g. again gpgagent.sh) with the following contents:

#!/bin/sh
# the second field of the GPG_AGENT_INFO variable is the
# process ID of the gpg-agent active in the current session
# so we'll just kill that, rather than all of them :)
[ -n "${GPG_AGENT_INFO}" ] && kill `echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2`


Optional

You can also use keychain, ~/.xsession startup, or any other method to start gpg-agent. Choose what you like, here are somes howtos:
http://www.funtoo.org/en/security/keychain/intro/
http://www.gentoo-wiki.info/HOWTO_KMail_gpg-agent_kde#Setting_up_gpg-agent_with_keychain
http://www.claws-mail.org/faq/index.php/Plugins#How_do_I_configure_gpg-agent_and_the_PGP_plugin.3F
man gpg-agent, section DESCRIPTION


Importing S/MIME certificates into gpgsm

Regardless whether you have obtained your S/MIME certificate in Mozilla Firefox or another browser, you have to export/backup it to a PKCS12 (.p12) file somewhere on your disk. I'm using the filename "certbundle.p12" for this howto, you can call it as you wish (e.g. $emailaddress_$certdate.p12)

Current versions of GnuPG support importing PKCS12 files directly, there's no need to use openssl anymore, as described in the previous howto. (If it doesn't work for you, you can still view the old howto through the history and use openssl to extract and convert the keys). Gpg-agent has to be properly setup and running by now.

$ gpgsm --import certbundle.p12


You will be asked to enter your passphrase for the backup file in the pinentry popup and you then have choose another passphrase for importing it to gpgsm. This passphrase will be the one you have to enter everytime you want to decrypt or sign emails (of course there's the possibility to cache the passphrase).

Now one has to add the issuer certificates (CA + intermediate CA) into gpgsm if they are not already there. The following command will add more than 100 CA certificates from the ca-certificates package, but you could also only add the specific CA's for your certificate if you want.

$ gpgsm --import /usr/share/ca-certificates/mozilla/*

Check if your key has been added:

$ gpgsm --list-secret-keys


Configuring GnuPG S/MIME

You'll now have to properly configure GnuPG for S/MIME. As opposed to the previous howto, we'll also be using certificate revocation list (CRL) support with dirmngr to be able to detect revoked certificates within the mail client. (It didn't work before because Thawte has some messed up CRL which GnuPG couldn't handle properly - but because Thawte doesn't provide S/MIME anymore, we're fine now :) We only have to import the large Thawte CRL once as all of their certificates have been revoked.

This is my "$HOME/.gnupg/gpgsm.conf":

disable-policy-checks
auto-issuer-key-retrieve
include-certs -1  # this will include all certificates in the chain up to the root
debug-level basic


You will also probably want to enter the following entry to gpgsm.conf ( use the fingerprint output from the command "gpgsm --list-secret-keys")

default-key  fingerprint_of_your_key


My "$HOME/.gnupg/dirmngr.conf" file only contains the following line, everything is set to default. Dirmngr will be used for CRL support internally by GnuPG. It is also possible to setup a system-wide dirmngr daemon which is not part of this howto (see man page).

debug-level basic


If you encounter any problems with CRL support you can use the old configuration files from the history in this wiki which disables it. Be aware that by having imported all CA's dirmngr might encounter a CRL where it can't fetch it properly and hangs (sometimes happens to me when starting kleopatra).

Importing Thawte CRL and testing CRL support

As of 16th November 2009 all Thawte S/MIME certificates have been revoked. As dirmngr doesn't automatically work with the Thawte CRL, one has to import them manually once. A working gpg-agent setup is again needed, then perform the following steps:

# download the Thawte CRL
wget http://crl.thawte.com/ThawtePersonalFreemailCA.crl
wget http://crl.thawte.com/ThawtePersonalFreemailIssuingCA.crl

# import to dirmngr
gpgsm --call-dirmngr loadcrl ThawtePersonalFreemailCA.crl
gpgsm --call-dirmngr loadcrl ThawtePersonalFreemailIssuingCA.crl


If you have old Thawte certificates that are still valid according to their expiry date or other revoked certificates you can verify that dirmngr works with the following command:

gpgsm --list-keys --with-validation <keyid|name|fingerprint>


The output will be like this:

 [...]
 validity: 2009-03-24 08:26:26 through 2010-03-24 08:26:26
 key type: 2048 bit RSA
 fingerprint: xxxx
 [certificate has been revoked]
 [validation model used: shell]
 [certificate is bad: Certificate revoked]

See "[certificate is bad: Certificate revoked]" message instead of "[certificate is good]".

Setting up the trust

We used the option "allow-mark-trusted" in gpg-agent.conf which allows the client to mark keys as trusted, i.e. put them in the file $HOME/.gnupg/trustlist.txt (see man gpg-agent). Hence you should be asked automatically to trust another key or CA, e.g. it mainly happens for me when I click on an email in Claws Mail where the CA is missing from trustlist.txt or when I start the tool "kleopatra" where I'm asked to trust the CAs.

If it doesn't work for you automatically you have to create the file (if it doesn't exist) "$HOME/.gnupg/trustlist.txt" to add your CA (e.g. Comodo, Thawte) to the trusted key list. This makes it possible to verify/sign/.../ with your personal certificate. I also added my own certificate to the trustlist.

Usually one adds the SHA1 fingerprints to the file (not the serial number, and it doesn't matter whether with or without the colon). With the following command (borrowed and adjusted from this German howto http://www.kire.ch/blog/2009/05/07/claws-mail-und-smime-verschlusselung-mit-cacert-zertifikat/) you can add all your CA's and keys at once (of course you have to trust all the CA's of the ca-certificate package - if you don't then you have to manually dump the certificate chain and add the fingerprints accordingly):

gpgsm --list-keys 2>/dev/null | grep fingerprint | awk '{print $2 " S"}' >> ~/.gnupg/trustlist.txt
(the command will append, not overwrite the old file)


Note that when manually changing trustlist.txt or gpg-agent.conf, you need to give gpg-agent a SIGHUP.

Setting up Claws Mail itself

There's not much you have to configure in Claws Mail. Go to the menu "Configuration - Edit Accounts | choose your account | - Edit - Account - Privacy - Default privacy system" => S-MIME
Set the options to your need, e.g. I've set all but the last (Save sent encrypted as clear text).
As we have configured gpgsm to use a "default key" you can set "Use default GnuPG key" in the Account preferences Plugins/GPG menu.

Working with Claws Mail S/MIME and problems/bugs

  • If you receive the error message "The signature can't be checked - Unknown IPC Command" and you're using "seahorse-agent" try to switch to the gpg-agent of the GnuPG package.
  • Error message "Cannot sign: General error" usually means that there's something wrong with the gpg-agent (e.g. not running or wrong environment)
  • If you're an old Thawte user trying to use their offer for a free VeriSign S/MIME certificate with Claws Mail, you're out of luck because GnuPG doesn't support the ancient MD2 algorithm being used by VeriSign for their CA. I've tried getting it to work but never succeeded (except by using Thunderbird), here's a statement from the developer of GnuPG/libgcrypt: http://lists.gnupg.org/pipermail/gpa-dev/2003-October/001482.html
  • I'm only aware of one problem in Claws Mail, where you'll get "Bad signature" warnings, when you forward (via CM) a signed+encrypted email with an attachment and sign+encrypt the email itself again too.
  • Error message: Couldn't decrypt: "unsupported algorithm" - this happens when you receive an email which got encrypted with the RC2 algorithm (e.g. some Outlook and some Thunderbird MUAs). I'm currently not aware of a solution on your side, as the underlying libgcrypt doesn't handle it for patent reasons. (see https://intevation.de/roundup/aegypten/issue11 and http://forums.mozillazine.org/viewtopic.php?p=2858116 ) You can ask your email partner to reconfigure their clients though (I know that it works for recent Outlook versions on >=Windows Vista to force certain algorithms).