https://www.claws-mail.org/faq/api.php?action=feedcontributions&user=GergelyCzuczy&feedformat=atom Claws Mail FAQ - User contributions [en] 2024-03-29T05:55:18Z User contributions MediaWiki 1.35.7 https://www.claws-mail.org/faq/index.php?title=S/MIME_howto&diff=1979 S/MIME howto 2008-02-29T11:57:46Z <p>GergelyCzuczy: Added section on the gpg-agent and KDE startup of it</p> <hr /> <div>==Claws Mail &amp; S/MIME plugin howto==<br /> <br /> Recently there were many requests on the mailing list on how to configure the S/MIME plugin to work properly. It is not a trivial task as the GUI doesn't provide any configuration options and everything needs to be done in the console.<br /> <br /> I've had a &quot;half-working&quot; setup but always failed on some point when importing S/MIME certificates. I now managed to have a working config and hopefully this howto will give an insight on how to achieve it.<br /> <br /> This howto is based on Gentoo but should be working fine on every other distribution if adjusting it accordingly :)<br /> <br /> ===Requirements===<br /> # recent Claws Mail version, recommended: v2.7.1 (multiple RFC fixes), or CVS<br /> # recent S/MIME plugin, recommended: v0.6.0 (multiple RFC fixes), or CVS<br /> # S/MIME certificate (this howto is based on Thawte Freemail certs)<br /> # pinentry, gnupg, gpgme, ca-certificates (and openssl) in recent versions<br /> # gpg-agent to cache the passphrase<br /> <br /> Those are the versions I'm using:<br /> <br /> # emerge -p pinentry gnupg gpgme ca-certificates<br /> [ebuild R ] app-crypt/pinentry-0.7.2-r3 USE=&quot;gtk ncurses qt3 -caps&quot; 390 kB<br /> [ebuild R ] app-crypt/gnupg-2.0.1-r1 USE=&quot;X bzip2 ldap nls -caps -doc -openct -pcsc-lite (-selinux) -smartcard&quot; 0 kB<br /> [ebuild R ] app-crypt/gpgme-1.1.2-r1 0 kB<br /> [ebuild R ] app-misc/ca-certificates-20050804 92 kB<br /> <br /> ===Optional===<br /> I'm using keychain to start gpg-agent. Choose what you like, here are somes howtos:<br /> &lt;br /&gt;<br /> http://www.claws-mail.org/faq/index.php/Plugins#How_do_I_configure_gpg-agent_and_the_PGP_plugin.3F http://gentoo-wiki.com/HOWTO_KMail_gpg-agent_kde#Setting_up_gpg-agent_with_keychain<br /> <br /> ===Runing the GPG agent===<br /> <br /> If you're using gpg2, then because of gpgme, claws-mail will depend on a running gpg-agent. This means, you will have to run a gpg-agent in order to be able to use anything via gpgme. A gpg-agent will need a pinentry application to ask for the pin. Running gpg-agent is quite trivial:<br /> <br /> eval `gpg-agent --daemon`<br /> <br /> As you see, it eval's, that means, gpg-agent returns an environment variable and exports it, something like `FOO=bar; export FOO`. 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.<br /> <br /> ====KDE Users====<br /> <br /> KDE has a way to run scripts and thus export environment variables at startup time. Every application running in this session will get these variables, so it's very handsome here. All you have to do is create a file under ~/.kde/env/ (if it doesn't exist, then create it). I named it gpgagent.sh. The contents of this shell script is quite trivial:<br /> <br /> #!/bin/sh<br /> <br /> eval `gpg-agent --daemon`<br /> <br /> Well done!<br /> <br /> ===Importing S/MIME certificates into gpgsm===<br /> (from http://www.gnupg.org/aegypten/development.en.html#howto_import_external_certs)<br /> &lt;br /&gt;&lt;br /&gt;<br /> First one has to obtain the Thawte Freemail certificate and install it into Firefox/Thunderbird. Export/Backup the certificate from Firefox/Thunderbird e.g. to &quot;certbundle.p12&quot; file and remember the passphrase.<br /> <br /> Convert the file into PEM format:&lt;br /&gt;<br /> $ openssl pkcs12 -in certbundle.p12 -out certbundle.pem -nodes<br /> (use the export passphrase)<br /> <br /> Extract the key: &lt;br /&gt;<br /> $ openssl pkcs12 -in certbundle.pem -export -out certkey.p12 -nocerts -nodes<br /> <br /> Import the key into gpgsm:&lt;br /&gt;<br /> $ gpgsm --call-protect-tool --p12-import --store certkey.p12<br /> <br /> Now one has to add the issuers certificate (Thawte) into gpgsm, you can use the certs included in the Freemail cert, but I did the following:<br /> &lt;br /&gt;<br /> $ gpgsm --import /usr/share/ca-certificates/mozilla/Thawte*<br /> (Thawte_Personal_Basic_CA.crt, Thawte_Personal_Premium_CA.crt, Thawte_Server_CA.crt, Thawte_Personal_Freemail_CA.crt, Thawte_Premium_Server_CA.crt, Thawte_Time_Stamping_CA.crt)<br /> <br /> Check if your key has been added:&lt;br /&gt;<br /> $ gpgsm --list-secret-keys<br /> <br /> If this doesn't show a secret key, you may have to import the three certificates from certbundle.pem: separate them to three files (starting with &quot;--- BEGIN CERTIFICATE ---&quot; and ending with &quot;--- END CERTIFICATE ---&quot;), then run &lt;br /&gt; <br /> $ gpgsm --import cert1.pem cert2.pem cert3.pem<br /> <br /> ===Configuring S/MIME===<br /> You need to create the file (if it doesn't exist) &quot;$HOME/.gnupg/trustlist.txt&quot; to add Thawte to the trusted key list. This makes it possible to verify/sign/.../ with your Thawte certificate. I also added my own certificate to the trustlist. Add the following lines which contain the fingerprint (not serial number!) of the key and the letter S at the end:&lt;br /&gt;<br /> <br /> # 1.2.840.113549.1.9.1=#706572736F6E616C2D667265656D61696C407468617774652E636F6D,CN=Thawte <br /> # Personal Freemail CA,OU=Certification Services Division,O=Thawte<br /> # Consulting,L=Cape Town,ST=Western Cape,C=ZA<br /> 209900B63D955728140CD13622D8C687A4EB0085 S<br /> &lt;br /&gt;<br /> <br /> You'll enter your own key similarly<br /> <br /> This is my &quot;$HOME/.gnupg/gpgsm.conf&quot;:&lt;br /&gt;<br /> disable-crl-checks<br /> disable-policy-checks<br /> auto-issuer-key-retrieve<br /> debug-level basic<br /> <br /> You will also probably want to enter your:<br /> <br /> default-key fingerprint_of_your_key<br /> <br /> &lt;br /&gt;<br /> gpg-agent is only necessary for caching the passphrase: &quot;$HOME/.gnupg/gpg-agent.conf&quot;&lt;br /&gt;<br /> <br /> pinentry-program /usr/bin/pinentry-qt<br /> default-cache-ttl 86400 # be aware that the passphrases will be cached for 86400 seconds! set accordingly to your need<br /> max-cache-ttl 86400<br /> disable-scdaemon<br /> allow-mark-trusted<br /> <br /> ===Working with S/MIME plugin and problems/bugs===<br /> * As of current CVS (CM =&gt;2.7.0cvs11 and S/MIME &gt;=0.5.8cvs2) the S/MIME plugin is more RFC compliant and signing, encrypting, decrypting and verifying messages is working very well now. I tested compatibility with Outlook 11 and Thunderbird, some Kmail emails in my inbox decrypt fine too!<br /> <br /> * I'm only aware of one problem, where you'll get &quot;Bad signature&quot; warnings, when you forward (via CM) a signed+encrypted email with an attachment and sign+encrypt the email itself again too.<br /> <br /> * Error: Couldn't decrypt: &quot;unsupported algorithm&quot; - this happens when you receive an email which got encrypted with RC2 algorithm (e.g. some Outlook 11 and some Thunderbird MUAs). I'm currently not aware of a solution, 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 )<br /> <br /> * It seems the &quot;Trust key&quot; dialog doesn't show the name of the key, e.g. &quot;The key of ' ' is not fully trusted&quot;. &lt;br /&gt;CM first asks for the key of the recipient and then asks for the sender's key because CM can't extract it properly: &quot;No exact match for 'email@address'; please select the key.&quot; (guess that is because I have two certs..).&lt;br /&gt; If I send an email to a friend and include myself (To:), CM will ask me three times for the correct keys.<br /> <br /> * As of now the &quot;Select Keys&quot; dialog when encrypting emails is a bit awkward to use if you have more than one key (e.g. one additional key that is expired and you still want to keep it to be able to decrypt older emails). It only shows the Key ID and no info about the expiry date which makes it more difficult to choose the correct one.</div> GergelyCzuczy