diff --git a/doc/Makefile.am b/doc/Makefile.am
index 3f77522..ceeff0c 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,27 +1,31 @@
# Makefile.am
# Copyright (C) 2006 g10 Code GmbH
#
# This file is part of Scute.
#
# Scute is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# Scute is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see .
# SPDX-License-Identifier: LGPL-2.1-or-later
## Process this file with automake to produce Makefile.in
-website = index.xhtml documentation.xhtml download.xhtml contact.xhtml \
- format/web.css format/scute-logo.svg format/scute-border.jpg
-
-EXTRA_DIST = $(addprefix website/, $(website))
+EXTRA_DIST = \
+ website/contact.xhtml /
+ website/documentation.xhtml /
+ website/download.xhtml /
+ website/index.xhtml /
+ website/format/scute-border.jpg /
+ website/format/scute-logo.svg /
+ website/format/web.css
SUBDIRS = manual
diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am
index a3b8321..4d37147 100644
--- a/doc/manual/Makefile.am
+++ b/doc/manual/Makefile.am
@@ -1,50 +1,66 @@
# Makefile.am - Doc directory Makefile for scute.
# Copyright (C) 2006, 2007 g10 Code GmbH
#
# This file is part of Scute.
#
# Scute is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# Scute is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see .
# SPDX-License-Identifier: LGPL-2.1-or-later
## Process this file with automake to produce Makefile.in
-DISTCLEANFILES = scute.tmp
-
images = firefox-cm.png firefox-cm-view-detail.png firefox-cm-view.png \
firefox-dm-load-after.png firefox-dm-load-before.png \
firefox-dm-load.png firefox-dm-token-present.png firefox-pref.png \
firefox-pref-view.png firefox-bad-pin.png \
thunderbird-account-settings.png thunderbird-smime-button.png \
libreoffice-certificate-selection.png \
libreoffice-digital-signatures.png libreoffice-pdf-signature.png
-images_eps = $(images:.png=.eps)
+# The same as images but eps suffix.
+images_eps = firefox-cm.eps firefox-cm-view-detail.eps firefox-cm-view.eps \
+ firefox-dm-load-after.eps firefox-dm-load-before.eps \
+ firefox-dm-load.eps firefox-dm-token-present.eps firefox-pref.eps \
+ firefox-pref-view.eps firefox-bad-pin.eps \
+ thunderbird-account-settings.eps thunderbird-smime-button.eps \
+ libreoffice-certificate-selection.eps \
+ libreoffice-digital-signatures.eps libreoffice-pdf-signature.eps
+
EXTRA_DIST = $(images)
-CLEANFILES = $(images_eps)
+
+CLEANFILES = $(images_eps)
+DISTCLEANFILES = scute.tmp
+
+BUILT_SOURCES = $(images_eps)
info_TEXINFOS = scute.texi
scute_TEXINFOS = lesser.texi
-scute.html: scute.texi $(foreach i,$(images),scute.html/$(i))
- $(MAKEINFO) --html --output "$@" "$<"
-scute.html/%.png: %.png
- @mkdir -p scute.html
- cp -v "$<" "$@"
-
-scute.dvi: $(images_eps)
-scute.pdf: $(images)
+.png.eps:
+ $(CONVERT) `test -f '$<' || echo '$(srcdir)/'`$< $@
-%.eps : %.png
+.png.pdf:
$(CONVERT) `test -f '$<' || echo '$(srcdir)/'`$< $@
+
+
+# Do not include the generated EPS files.
+dist-hook:
+ cd $(distdir) && rm -f $(images_eps)
+
+
+# Make sure that scute.texi is touched if any other source file has
+# been modified. This is required so that the version.texi magic
+# updates the release date.
+scute.texi : $(scute_TEXINFOS) $(images)
+ touch $(srcdir)/scute.texi
diff --git a/doc/manual/scute.texi b/doc/manual/scute.texi
index b27da91..1d699a9 100644
--- a/doc/manual/scute.texi
+++ b/doc/manual/scute.texi
@@ -1,872 +1,872 @@
\input texinfo @c -*- Texinfo -*-
@setfilename scute.info
@settitle The Scute Manual
@dircategory GNU Utilities
@direntry
* Scute: (scute). PKCS #11 module for the OpenPGP Card
@end direntry
@include version.texi
@c Unify some of the indices.
@syncodeindex tp fn
@syncodeindex pg fn
@ifinfo
This file documents the Scute module.
This is Edition @value{EDITION}, last updated @value{UPDATED}, of
@cite{The Scute Manual}, for Version @value{VERSION}.
@c NOTE: Don't forget to update the year for the TeX version, too.
Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH.
The Scute Manual is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. The text of the
license can be found in the section entitled ``Library Copying''.
The Scute Manual is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.
@end ifinfo
@iftex
@shorttitlepage The Scute Manual
@end iftex
@titlepage
@center @titlefont{The Scute Manual}
@sp 6
@center Edition @value{EDITION}
@sp 1
@center last updated @value{UPDATED}
@sp 1
@center for version @value{VERSION}
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH.
The Scute Manual is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version. The text of the
license can be found in the section entitled ``Library Copying''.
The Scute Manual is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
+lesser General Public License for more details.
@end titlepage
@page
@ifnottex
@node Top
@top Main Menu
This is Edition @value{EDITION}, last updated @value{UPDATED}, of
@cite{The Scute Manual}, for Version @value{VERSION} of the Scute
module.
@end ifnottex
@menu
* Introduction:: How to use this manual.
* Preparation:: What you should do before using Scute.
* Client Authentication:: How to use Scute for client authentication.
* Email Signing:: How to use Scute for S/MIME email signing.
* Document Signing:: How to use Scute with LibreOffice.
* Troubleshooting:: What to do when things go wrong.
* Internals:: Technical details about Scute.
Appendices
* Library Copying:: The GNU General Public License says
how you can copy and share Scute.
Indices
* Concept Index:: Index of concepts and programs.
@detailmenu
--- The Detailed Node Listing ---
Introduction
* Getting Started:: Purpose of the manual, and how to use it.
* Features:: Reasons to install and use Scute.
* Overview:: Basic architecture of the Scute module.
Preparation
* Prerequisites:: Dependencies of Scute.
* Building the Source:: How to build Scute.
* Certificate Preparation:: Preparing certificates for use with Scute.
Client Authentication
* Application Configuration:: Preparing the application for use with Scute.
* Authentication With Service:: Using Scute for client authentication.
Email Signing
Document Signing
Troubleshooting
Internals
* Features and Limitations:: Details about the interfaces implemented.
* Developing Scute:: How to understand or improve Scute.
* Mozilla Compatibility:: Interoperability notes for Mozilla NSS.
@end detailmenu
@end menu
@node Introduction
@chapter Introduction
This is a PKCS #11 implementation for the GnuPG Agent using the GnuPG
Smart Card Daemon. Currently, only the OpenPGP card is supported.
Scute enables use of the OpenPGP smart card in applications supporting
PKCS #11 compliant security tokens. The main application at this time
is client authentication in Mozilla-based web browsers. In the future,
other applications will be supported.
@menu
* Getting Started:: Purpose of the manual, and how to use it.
* Features:: Reasons to install and use Scute.
* Overview:: Basic architecture of the Scute module.
@end menu
@node Getting Started
@section Getting Started
This manual documents the Scute module, how it can be used for common
applications supported by it, and how it can be extended and improved by
programmers. It is thus a user manual as well as a developer manual.
The reader is assumed to possess basic knowledge about cryptography in
general, and public key cryptography in particular. The underlying
cryptographic engines that are used by the library are not explained,
but where necessary, special features or requirements are provided.
This manual can be used in several ways. If read from the beginning to
the end, it gives a good introduction into the module and how it can be
used in an application. Forward references are included where
necessary. Later on, the manual can be used as a reference manual to
get just the information needed about any particular application of the
module.
@node Features
@section Features
Scute is currently the only implementation of PKCS #11 for the OpenPGP
smart card. Apart from that, it offers a couple of other benefits:
@table @asis
@item it's free software
Anybody can use, modify, and redistribute it under the terms of the GNU
General Public License (@pxref{Library Copying}).
@item it's built to grow
Although Scute initially provided a single function, client
authentication using OpenPGP smart cards in Mozilla-based web browsers,
it was built with the intention of supporting other applications as well
in the future.
@item it's easy
Building and installing Scute is easy, and preparing smart cards for use
with Scute is a snatch using the GnuPG 2 framework. The integration
of Scute into the application is seamless.
@end table
@node Overview
@section Overview
Scute is a security device that implements the PKCS #11 interface for
security tokens. Applications which know how to use the PKCS #11
interface to access security tokens for cryptographic operations can use
Scute to access the OpenPGP smart card. An important example of such an
application is the Firefox web browser by the Mozilla project, which
uses the Mozilla Network Security Services library (NSS).
Scute itself does not include a driver for the smart card itself.
Instead, it uses the GnuPG 2 framework to access the smart cards and
associated data like certificates. Scute acts as the glue between the
application and GnuPG 2.
Currently supported usages are client authentication over HTTPS with
Firefox (allowing users to authenticate themselves to a remote web
service without entering their log-in information), email signing
with Thunderbird, and document signing with LibreOffice.
@node Preparation
@chapter Preparation
To use Scute, you first have to install the software. You also have to
prepare each card you want to use with Scute before it can be used.
Furthermore, you need to configure the application to make use of Scute
for cryptographic operations. This chapter explains each of these steps
in detail.
@menu
* Prerequisites:: Dependencies of Scute.
* Building the Source:: How to build Scute.
* Certificate Preparation:: Preparing certificates for use with Scute.
@end menu
@node Prerequisites
@section Prerequisites
There are two types of dependencies for Scute: compile-time dependencies
and run-time dependencies. The compile-time dependencies only need to
be fulfilled when Scute is compiled and installed. The run-time
dependencies need to be fulfilled when Scute is used in an application.
Scute depends, in addition to the essential build utilities, on the
following packages at build time:
@table @code
@item libgpg-error
Scute uses the GnuPG 2 framework for error handling, so it depends on
the GPG error library. The minimum version required is 1.14.
@item libassuan
Scute uses the GnuPG 2 framework for communication with the GPG Agent,
so it depends on the Assuan library. The minimum version required is
2.0.0.
@end table
At run-time, in addition to the run-time versions of the above
libraries, you also need the following packages installed and
configured:
@table @asis
@item GnuPG
Scute uses the GnuPG 2 framework to access the OpenPGP card and for
certificate management. The minimum version required is 2.0.0 for
client authentication with TLS 1.0 and 1.1. Client authentication
with TLS 1.2, email and document signing require GnuPG 2.1.0.
@item Pinentry
Pinentry is a dependency of GnuPG 2, so it also needs to be installed
with it.
@item Firefox et al.
Firefox is the first application supported by Scute. In the future,
other applications may be supported. The applications are not
dependencies of Scute, but Scute can not be used stand-alone, so you can
not experience it without an application.
@end table
@node Building the Source
@section Building the Source
Scute does comply to the GNU coding standards and thus can be compiled
and installed according to the generic installation instructions found
in the source package in the file @code{INSTALL}. There are no Scute
specific options to the configure script.
After installation, the @code{scute.so} module file can be found in
the library directory of the installation path.
@node Certificate Preparation
@section Certificate Preparation
To use an OpenPGP card with Scute, it first has to be initialized by
generating or loading a key on the card, see
@uref{http://www.gnupg.org/(en)/howtos/card-howto/en/smartcard-howto.html,
the OpenPGP Card How-To}. Then a certificate has to be created and
imported into GPGSM. This task involves three steps: First, a
certificate signing request (@acronym{CSR}) has to be created that
matches the key on the card. This certificate signing request then has
to be submitted to a certificate authority (@acronym{CA}), which will
create the certificate and send it back to you. At last, the
certificate has to be imported into GPGSM. This section will explain
all of these steps in detail.
@menu
* Creating a CSR:: How to create a card-based CSR.
* Signing the CSR:: Obtain a certificate from the CSR.
* Importing the Certificate:: How to import the certificate into GPGSM.
* On-card Certificate:: How to store the certificate on the card.
@end menu
@node Creating a CSR
@subsection Creating a CSR
Before you start, make sure that the GPG Agent is running, see
@ref{Prerequisites} and that your card is in the reader. There is no
need to configure GPGSM, so you can create a CSR with the command:
@example
$ gpgsm --gen-key > floppy-head.csr
Please select what kind of key you want:
(1) RSA
(2) Existing key
(3) Existing key from card
Your selection? 3
@end example
As we create a certificate for the OpenPGP Card, the option ``@code{[3]
Direct from card}'' should be selected.
@example
Serial number of the card: 355F9746499F0D4B4ECEE4928B007D16
Available keys:
(1) D53137B94C38D9BF6A199706EA6D5253 OPENPGP.1
(2) B0CD1A9DFC3539A1D6A8B851A11C8665 OPENPGP.2
(3) 53DB41052CC590A40B403F3E6350E5DC OPENPGP.3
Your selection? 3
Possible actions for a RSA key:
(1) sign, encrypt
(2) sign
(3) encrypt
Your selection? 2
@end example
The only operation currently supported is client authentication. For
this, the authentication key has to be selected. This is the third key
on the card, so the options ``@code{[3] OPENPGP.3}'' and ``@code{[2]
sign}'' should be chosen. Note that the key usage is only advisory, and
the CA may assign different capabilities.
@example
Enter the X.509 subject name: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
Enter email addresses (end with an empty line):
> floppy.head@@example.org
>
Enter DNS names (optional; end with an empty line):
>
Enter URIs (optional; end with an empty line):
>
Create self-signed certificate? (y/N) n
@end example
As a last step, the common name and e-mail address of the key owner need
to be specified by you. The above are only an example for a fictious
person working at a fictious company. DNS names are only meaningful for
server certificates and thus should be left empty.
We have now entered all required information and gpgsm will display what
it has gathered and ask whether to create the certificate request:
@example
These parameters are used:
Key-Type: card:OPENPGP.3
Key-Length: 1024
Key-Usage: sign
Name-DN: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
Name-Email: floppy.head@@example.org
Proceed with creation? (y/N) y
Now creating certificate request. This may take a while ...
gpgsm: about to sign the CSR for key: &53DB41052CC590A40B403F3E6350E5DC
@end example
GPGSM will now start working on creating the request. During this time
you will be asked once for a passphrase to unprotect the authentication
key on the card. A pop up window will appear to ask for it.
When it is ready, you should see the final notice:
@example
gpgsm: certificate request created
Ready. You should now send this request to your CA.
@end example
Now, you may look at the created request:
@example
$ cat floppy-head.csr
-----BEGIN CERTIFICATE REQUEST-----
MIICCDCCAXECAQAwgYExCzAJBgNVBAYTAlhZMRUwEwYDVQQIEwxTbmFrZSBEZXNl
cnQxEzARBgNVBAcTClNuYWtlIFRvd24xFzAVBgNVBAoTDlNuYWtlIE9pbCwgTHRk
MRcwFQYDVQQLEw5XZWJzZXJ2ZXIgVGVhbTEUMBIGA1UEAxMLRmxvcHB5IEhlYWQw
gaAwDQYJKoZIhvcNAQEBBQADgY4AMIGKAoGBANWaM9YS89AOx3GX1Rua+4DUHwbL
wt0rBYdBddlabMMteVjUcOOhbFMirLpLAi1S8fUXNiy84ysOmFStmvSIXDsAgXq5
1ESOU4SNg2zEkPDF1WYJ5BFIXdYq9i2k5W7+ctV8PkKv3e5IeYXTa5qppIPD31de
gM8Qj7tK0hL/eNCfAgQAAQABoEUwQwYJKoZIhvcNAQkOMTYwNDAiBgNVHREEGzAZ
gRdmbG9wcHkuaGVhZEBleGFtcGxlLmNvbTAOBgNVHQ8BAf8EBAMCBsAwDQYJKoZI
hvcNAQEFBQADgYEAFC9q6+ib9YGCLB/2AlZR+/dvb+pEeXR1EbpV/dw/gjP1yPY6
29n8ZIDLUvQvNCtfCcXFxFimVSSB/KmFXXsJbM+NXQyT6Ocn34iHmkf9IVRMWQWg
ZBYfQVeXAd7XlxI6d1wXDLwD/26lTU/rH2JU6H1+zSfZxqwVC4Iu+kiN4Y8=
-----END CERTIFICATE REQUEST-----
$
@end example
@node Signing the CSR
@subsection Signing the CSR
The next step is to submit this certificate request to the CA, which can
then create a certificate and send it back to you.
If, for example, you use the CA @uref{http://www.cacert.org, CAcert},
then you can log into your account at the CAcert website, choose
``Client Certificates -> New'', check ``Show advanced options'', paste
the above request block into the text field and click on ``Submit''.
If everything works correctly, a certificate will be shown, which you
can cut and paste into a new file @file{floppy-head.crt}.
Alternatively if, for example, you set up your own CA with OpenSSL, then
you can create your own certificate by issueing a command similar
@code{openssl ca -in floppy-head.csr -cert snakeoil-ca-rsa.crt -keyfile
snakeoil-ca-rsa.key -out floppy-head.crt}. Please see the OpenSSL
documentation for more details on how to set up and administrate a
certificate authority infrastructure.
@node Importing the Certificate
@subsection Importing the Certificate into GPGSM
Once the CSR has been signed, you should end up with a certificate file
@file{floppy-head.crt}, which you then have to import into GPGSM. It is
also recommended that you import the root certificate of the CA first in
the same fashion.
@example
$ gpgsm --import floppy-head.crt
gpgsm: certificate imported
gpgsm: total number processed: 1
gpgsm: imported: 1
@end example
gpgsm tells you that it has imported the certificate. It is now
associated with the key you used when creating the request. To see the
content of your certificate, you may now enter:
@example
$ gpgsm -K Floppy
/home/foo/.gnupg/pubring.kbx
---------------------------
Serial number: 10
Issuer: /CN=Snake Oil CA/OU=Certificate Authority/O=Snake Oil, Ltd/L=Snake Town/ST=Snake Desert/C=XY/EMail=ca@@snakeoil.dom
Subject: /CN=Floppy Head/OU=Webserver Team/O=Snake Oil, Ltd/ST=Snake Desert/C=XY
validity: 2006-11-11 14:09:12 through 2007-11-11 14:09:12
key type: 1024 bit RSA
fingerprint: EC:93:A2:55:C6:58:7F:C9:9E:96:DB:12:6E:64:99:54:BB:E1:94:68
@end example
The option ``@code{-K}'' is used above because this will only list
certificates for which a private key is available. To see more details,
you may use ``@code{--dump-secret-keys}'' instead of ``@code{-K}''.
@node On-card Certificate
@subsection Loading the Certificate onto the Card
This step is optional. You may choose to store the certificate directly
into your OpenPGP card. The benefit of doing so is that Scute will then
be able to fetch the certificate from the card without having to look
into the GPGSM store.
You need your certificate in the DER format. Export it from the GPGSM
store with the following command:
@example
$ gpgsm -o floppy-head.crt --export Floppy
@end example
Then, fire up the GnuPG card editor to transfer the certificate to the
card (note that the @code{writecert} command is not listed in the
editor's online help):
@example
$ gpg2 --card-edit
Application ID ...: D27600012301020000005000012340000
[...]
gpg/card> admin
Admin commands are allowed
gpg/card> writecert 3 < floppy-head.crt
gpg/card> quit
@end example
@node Client Authentication
@chapter Client Authentication
@menu
* Application Configuration:: Preparing the application for use with Scute.
* Authentication With Service:: Using Scute for client authentication.
@end menu
Scute allows you to authenticate yourself to a website securely without
entering a username or password by simply using your OpenPGP card.
Currently, only Mozilla-based browsers like Firefox are supported,
although other applications using Mozilla NSS or supporting PKCS #11
modules may work.
@node Application Configuration
@section Application Configuration
To prepare your application for use with Scute, you have to load the
Scute module as a PKCS #11 module into the application. With Firefox,
this can be done by choosing @code{Edit->Preferences} in the menu. In
the preferences configuration dialog, you should select the
@code{Advanced} configuration section, then the @code{Security} tab, and
then select @code{Security Devices} in the category @code{Certificates}.
@center @image{firefox-pref,13cm}
In the devices manager dialog, you can select @code{Load} to load a new
PKCS #11 device.
@center @image{firefox-dm-load-before,13cm}
In the pop-up dialog that follows, you can give a module name
(e.g. ``@code{Scute}'') and a module filename. The latter should
correspond to the full file name of the installed Scute module file
@file{scute.so}. The default installation path is
@file{/usr/local/lib}, which would mean that you have to provide the
file name @file{/usr/local/lib/scute.so}. If you or your system
administrator installed Scute in a different location, you have to
adjust the file name correspondingly.
@center @image{firefox-dm-load,8cm}
After confirming installation of the security device, a pop-up window
should confirm that the module was successfully loaded, and an entry for
the security device should appear in the device manager list of
@code{Security Modules and Devices}.
@center @image{firefox-dm-load-after,15cm}
When you insert the OpenPGP card for which you generated and imported a
certificate earlier (see @ref{Certificate Preparation}), the device
manager should detect this security token and display some information
about it in the @code{Details} list when you select it from the module
list.
@center @image{firefox-dm-token-present,15cm}
The client certificate will show up in the @code{Certificate Manager}
under @code{Your Certificates}:
@center @image{firefox-cm,13cm}
@node Authentication With Service
@section Authentication With Service
Before you access a web service which requires client authentication,
for instance a fictious web service
@ifnottex
@indicateurl{https://example.com},
@end ifnottex
@iftex
@code{https://example.com},
@end iftex
the OpenPGP card should be present. In this case, a pop-up window will
appear that requests you to enter the PIN number protecting the
authentication key on the OpenPGP card. After entering the PIN number,
your browser will be authenticated to the server. If the server accepts
your request and certificate, this is all which is required. You should
leave the card in the reader as long as the connection persists.
Depending on how aggressively GPG Agent caches your PIN number, you may
have to enter the PIN number again later to keep up the connection to
the server.
If the card is not present, or you enter the wrong PIN, or the server
does not admit your certificate, you will get an error message. This
error message is generated by the application and Scute can not
influence it. Unfortunately, in Firefox (at least up to version
38.5.0), this error message is not very user friendly. For example,
entering a bad PIN results in the following generic error message, and
the @code{Try Again} button does not work as expected:
@center @image{firefox-bad-pin,11cm}
@comment FIXME: Document possible error codes.
@node Email Signing
@chapter Email Signing
Scute also allows you to use your card-based X.509 certificate to sign
your emails with the S/MIME signature format. This has been tested
with Mozilla Thunderbird only, but should work with any mail client
with support for PKCS #11 (notably GNOME Evolution).
You must first load the Scute module into your mail client. With
Mozilla Thunderbird, the procedure is the same as the one described
above for Mozilla Firefox.
Then, open your accent configuration dialog (@code{Edit->Account
Settings}), and in the @code{Security} tab, under the section
@code{Digital Signing}, use the @code{Select...} button to associate
your card-based certificate with your account.
@center @image{thunderbird-account-settings,13cm}
When writing a new message, you may then use the @code{S/MIME} button
and select @code{Digitally sign this message} in the popup menu. You
will be prompted for your User PIN before the message is sent.
@center @image{thunderbird-smime-button,13cm}
@node Document Signing
@chapter Document Signing
Scute can also be used with LibreOffice to sign OpenDocument files.
First, you must load the Scute module into Mozilla Firefox according to
the above procedure. Then, configure LibreOffice to use Firefox's
certificate store by defining the @code{MOZILLA_CERTIFICATE_FOLDER}
environment variable to your Firefox profile directory.
Then, to sign the document you are editing, select the
@code{File->Digital Signatures...} menu option to open the
@code{Digital Signatures} dialog.
@center @image{libreoffice-digital-signatures,13cm}
Click the @code{Sign Document} button to open the certificate selection
dialog. Select your card-based certificate, then validate. Enter your
User PIN when prompted by GPG Agent.
@center @image{libreoffice-certificate-selection,13cm}
You may also sign a PDF export of your document. Select the
@code{File->Export as PDF...} menu option to open the @code{PDF Options}
dialog. In the @code{Digital Signatures} tab, use the @code{Select}
button to open the certificate selection dialog as above. You will be
prompted for your User PIN when you will click the @code{Export} button.
@center @image{libreoffice-pdf-signature,13cm}
@node Troubleshooting
@chapter Troubleshooting
@strong{Symptom:} Loading the Scute security device in the security
device manager of Firefox fails with "Unable to load module".
@strong{Solution:} Make sure that Scute is correctly installed, and that
all libraries and executables are available. If you are using GnuPG
2.0 (instead of 2.1), you may need to make sure that the GPG Agent is
running and can be found via the environment variable
@code{GPG_AGENT_INFO}. @xref{Invoking GPG-AGENT, , , gnupg, Using the
GNU Privacy Guard}, for details on how to run the GPG Agent.
@strong{Symptom:} Client authentication fails with " has
received an incorrect or unexpected message. Error code: -12227".
@strong{Solution:} Make sure that the correct OpenPGP card is inserted
and the certificate available in GPGSM. Check that the OpenPGP card is
detected correctly in the security device manager and the corresponding
certificate is displayed in the certificate manager of Firefox.
@xref{Authentication With Service}.
@strong{Symptom:} The OpenPGP card is detected and displayed in the
security device manager in Firefox, but no corresponding certificate is
displayed in the certificate manager of Firefox.
@strong{Solution:} Make sure that the corresponding certificate is
imported in GPGSM.
@comment FIXME: Can this really happen???
@node Internals
@chapter Internals
The following notes are intended for people interested in more technical
details about Scute and its implementation. They give an overview about
its scope and potential compatibility issues with applications.
@menu
* Features and Limitations:: Details about the interfaces implemented.
* Developing Scute:: How to understand or improve Scute.
* Mozilla Compatibility:: Interoperability notes for Mozilla NSS.
@end menu
@node Features and Limitations
@section Features and Limitations
Scute implements version 2.20 of the
@uref{https://www.emc.com/emc-plus/rsa-labs/standards-initiatives/pkcs-11-cryptographic-token-interface-standard.htm, PKCS #11}
specification.
The @uref{http://www.g10code.com/p-card.html,OpenPGP smart card}
application is supported in read-only mode.
The following functions are not supported:
@table @code
@item C_Initialize
No support for native thread package. Locking callbacks must be
provided if multi-threaded operation is desired.
@item C_WaitForSlotEvent
Not implemented. The interface as specified by PKCS #11 is broken
anyway, as the function can not safely be canceled. Thus, we require
polling.
@item C_GetOperationState
@itemx C_SetOperationState
Not supported.
@item C_InitToken
@itemx C_InitPIN
@itemx C_SetPIN
Not supported. No write operations are allowed. To configure the
token, please use the tools accompanying the GnuPG software suite.
@item C_Login
@itemx C_Logout
Not supported. No login into the token by the software is required.
Passphrase queries are implemented by the use of GPG Agent and Pinentry.
@item C_EncryptInit
@itemx C_Encrypt
@itemx C_EncryptUpdate
@itemx C_EncryptFinal
@itemx C_DigestInit
@itemx C_Digest
@itemx C_DigestUpdate
@itemx C_DigestKey
@itemx C_DigestFinal
@itemx C_VerifyInit
@itemx C_Verify
@itemx C_VerifyUpdate
@itemx C_VerifyFinal
@itemx C_VerifyRecoverInit
@itemx C_VerifyRec
Not supported. Only secret key operations are supported.
@item C_DecryptInit
@itemx C_Decrypt
Not yet supported, but will be in the future.
@item C_SignUpdate
@itemx C_SignFinal
@itemx C_DecryptUpdate
@itemx C_DecryptFinal
No progressive crypto-operations are supported.
@item C_SignRecoverInit
@itemx C_SignRecover
Not supported.
@item C_DigestEncryptUpdate
@itemx C_DecryptDigestUpdate
@itemx C_SignEncryptUpdate
@itemx C_DecryptVerifyUpdate
Dual-purpose cryptographic functions are not supported.
@item C_GenerateKey
@itemx C_GenerateKeyPair
@itemx C_WrapKey
@itemx C_UnwrapKey
@itemx C_DeriveKey
Key management functions are not supported. Please use the tools
accompanying the GnuPG software suite to generate and import keys for
use with the token.
@item C_SeedRandom
Not supported.
@item C_CreateObject
@itemx C_CopyObject
@itemx C_DestroyObject
@itemx C_SetAttributeValue:
Only read-only operations are supported on objects.
@item C_GetObjectSize
Not supported.
@item CKO_CERTIFICATE
The label specifies the key on the card used (e.g. @code{OPENPGP.3}).
The ID is the fingerprint.
@item CKO_PRIVATE_KEY:
The @code{CKA_LOCAL} attribute can not be supported by the OpenPGP card.
It is always set to false (as the key on the card may be copied to the
card from an external source).
@end table
@node Developing Scute
@section Developing Scute
Scute is single-threaded. There is a global lock that is taken in all
entry points of Scute, except for @code{C_Initialize},
@code{C_Finalize}, @code{C_GetFunctionList}, and stubs.
Here are a couple of hints on how to develop PKCS #11 modules for
Mozilla:
@code{libopensc2} ships with a @code{pkcs11-spy} library that can be
loaded as a wrapper around the PKCS #11 library you want to use to log
all functions invoked by Mozilla. Here is how to use it:
Set the @code{PKCS11SPY_OUTPUT} environment variable to a filename.
@code{pkcs11-spy} appends its log messages at the end of this file. Set
the @code{PKCS11SPY} environment variable to the filename of the PKCS
#11 module you actually want to use. Start Mozilla within this
environment.
There is a different, probably more powerful way to debug Mozilla PKCS
#11 libraries. However, to be able to use it, you need to configure and
compile the Mozilla NSS sources with @code{--enable-debug}.
Instructions can be found at:
@uref{https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/nss_tech_notes}
Here are a couple of links to more information about implementing a
PKCS #11 module for Mozilla:
@table @uref
@item https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/PKCS11_Implement
Guidelines for implementors of PKCS #11 modules targeting Mozilla
@item http://www-archive.mozilla.org/projects/security/pki/pkcs11/
PKCS #11 Conformance Testing
@item https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
The Mozilla NSS web page
@end table
@node Mozilla Compatibility
@section Mozilla Compatibility
Mozilla has a bug that causes the wrong security device to be unloaded
when unloading a security device. Also, the displayed list becomes
corrupt. When closing and reopening the security device manager, the
list displayed is correct, but in anyway the wrong security module is
unloaded.
@include lesser.texi
@node Concept Index
@unnumbered Concept Index
@printindex cp
@summarycontents
@contents
@bye