scute.texi 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. \input texinfo @c -*- Texinfo -*-
  2. @setfilename scute.info
  3. @settitle The Scute Manual
  4. @dircategory GNU Utilities
  5. @direntry
  6. * Scute: (scute). PKCS #11 module for the OpenPGP Card
  7. @end direntry
  8. @include version.texi
  9. @c Unify some of the indices.
  10. @syncodeindex tp fn
  11. @syncodeindex pg fn
  12. @ifinfo
  13. This file documents the Scute module.
  14. This is Edition @value{EDITION}, last updated @value{UPDATED}, of
  15. @cite{The Scute Manual}, for Version @value{VERSION}.
  16. @c NOTE: Don't forget to update the year for the TeX version, too.
  17. Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH.
  18. The Scute Manual is free software; you can redistribute it and/or modify
  19. it under the terms of the GNU General Public License as published by the
  20. Free Software Foundation; either version 2 of the License, or (at your
  21. option) any later version.
  22. The Scute Manual is distributed in the hope that it will be useful, but
  23. WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  25. General Public License for more details.
  26. You should have received a copy of the GNU Lesser General Public License
  27. along with this program; if not, write to the Free Software Foundation,
  28. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  29. @end ifinfo
  30. @iftex
  31. @shorttitlepage The Scute Manual
  32. @end iftex
  33. @titlepage
  34. @center @titlefont{The Scute Manual}
  35. @sp 6
  36. @center Edition @value{EDITION}
  37. @sp 1
  38. @center last updated @value{UPDATED}
  39. @sp 1
  40. @center for version @value{VERSION}
  41. @page
  42. @vskip 0pt plus 1filll
  43. Copyright @copyright{} 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH.
  44. The Scute Manual is free software; you can redistribute it and/or modify
  45. it under the terms of the GNU General Public License as published by the
  46. Free Software Foundation; either version 2 of the License, or (at your
  47. option) any later version.
  48. The Scute Manual is distributed in the hope that it will be useful, but
  49. WITHOUT ANY WARRANTY; without even the implied warranty of
  50. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  51. General Public License for more details.
  52. You should have received a copy of the GNU Lesser General Public License
  53. along with this program; if not, write to the Free Software Foundation,
  54. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  55. @end titlepage
  56. @page
  57. @ifnottex
  58. @node Top
  59. @top Main Menu
  60. This is Edition @value{EDITION}, last updated @value{UPDATED}, of
  61. @cite{The Scute Manual}, for Version @value{VERSION} of the Scute
  62. module.
  63. @end ifnottex
  64. @menu
  65. * Introduction:: How to use this manual.
  66. * Preparation:: What you should do before using Scute.
  67. * Client Authentication:: How to use Scute for client authentication.
  68. * Troubleshooting:: What to do when things go wrong.
  69. * Internals:: Technical details about Scute.
  70. Appendices
  71. * Copying:: The GNU General Public License says
  72. how you can copy and share Scute.
  73. Indices
  74. * Concept Index:: Index of concepts and programs.
  75. @detailmenu
  76. --- The Detailed Node Listing ---
  77. Introduction
  78. * Getting Started:: Purpose of the manual, and how to use it.
  79. * Features:: Reasons to install and use Scute.
  80. * Overview:: Basic architecture of the Scute module.
  81. Preparation
  82. * Prerequisites:: Dependencies of Scute.
  83. * Building the Source:: How to build Scute.
  84. * Certificate Preparation:: Preparing certificates for use with Scute.
  85. Client Authentication
  86. * Application Configuration:: Preparing the application for use with Scute.
  87. * Authentication With Service:: Using Scute for client authentication.
  88. Troubleshooting
  89. Internals
  90. * Features and Limitations:: Details about the interfaces implemented.
  91. * Developing Scute:: How to understand or improve Scute.
  92. * Mozilla Compatibility:: Interoperability notes for Mozilla NSS.
  93. @end detailmenu
  94. @end menu
  95. @node Introduction
  96. @chapter Introduction
  97. This is a PKCS #11 implementation for the GnuPG Agent using the GnuPG
  98. Smart Card Daemon. Currently, only the OpenPGP card is supported.
  99. Scute enables use of the OpenPGP smart card in applications supporting
  100. PKCS #11 compliant security tokens. The main application at this time
  101. is client authentication in Mozilla-based web browsers. In the future,
  102. other applications will be supported.
  103. @menu
  104. * Getting Started:: Purpose of the manual, and how to use it.
  105. * Features:: Reasons to install and use Scute.
  106. * Overview:: Basic architecture of the Scute module.
  107. @end menu
  108. @node Getting Started
  109. @section Getting Started
  110. This manual documents the Scute module, how it can be used for common
  111. applications supported by it, and how it can be extended and improved by
  112. programmers. It is thus a user manual as well as a developer manual.
  113. The reader is assumed to possess basic knowledge about cryptography in
  114. general, and public key cryptography in particular. The underlying
  115. cryptographic engines that are used by the library are not explained,
  116. but where necessary, special features or requirements are provided.
  117. This manual can be used in several ways. If read from the beginning to
  118. the end, it gives a good introduction into the module and how it can be
  119. used in an application. Forward references are included where
  120. necessary. Later on, the manual can be used as a reference manual to
  121. get just the information needed about any particular application of the
  122. module.
  123. @node Features
  124. @section Features
  125. Scute is currently the only implementation of PKCS #11 for the OpenPGP
  126. smart card. Apart from that, it offers a couple of other benefits:
  127. @table @asis
  128. @item it's free software
  129. Anybody can use, modify, and redistribute it under the terms of the GNU
  130. General Public License (@pxref{Copying}).
  131. @item it's built to grow
  132. Although Scute currently only provides a single function, client
  133. authentication using OpenPGP smart cards in Mozilla-based web browsers,
  134. it was built with the intention of supporting other applications as well
  135. in the future.
  136. @item it's easy
  137. Building and installing Scute is easy, and preparing smart cards for use
  138. with Scute is a snatch using the GnuPG 2.0 framework. The integration
  139. of Scute into the application is seamless.
  140. @end table
  141. @node Overview
  142. @section Overview
  143. Scute is a security device that implements the PKCS #11 interface for
  144. security tokens. Applications which know how to use the PKCS #11
  145. interface to access security tokens for crytpographic operations can use
  146. Scute to access the OpenPGP smart card. An important example of such an
  147. application is the Firefox web browser by the Mozilla project, which
  148. uses the Mozilla Network Security Services library (NSS).
  149. Scute itself does not include a driver for the smart card itself.
  150. Instead, it uses the GnuPG 2.0 framework to access the smart cards and
  151. associated data like certificates. Scute acts as the glue between the
  152. application and GnuPG 2.0.
  153. Currently, only client authentication over HTTPS with Firefox using the
  154. OpenPGP card is supported. In this configuration, Scute allows users to
  155. authenticate themselves to a remote web service without entering their
  156. log-in information.
  157. @node Preparation
  158. @chapter Preparation
  159. To use Scute, you first have to install the software. You also have to
  160. prepare each card you want to use with Scute before it can be used.
  161. Furthermore, you need to configure the application to make use of Scute
  162. for cryptographic operations. This chapter explains each of these steps
  163. in detail.
  164. @menu
  165. * Prerequisites:: Dependencies of Scute.
  166. * Building the Source:: How to build Scute.
  167. * Certificate Preparation:: Preparing certificates for use with Scute.
  168. @end menu
  169. @node Prerequisites
  170. @section Prerequisites
  171. There are two types of dependencies for Scute: compile-time dependencies
  172. and run-time dependencies. The compile-time dependencies only need to
  173. be fulfilled when Scute is compiled and installed. The run-time
  174. dependencies need to be fulfilled when Scute is used in an application.
  175. Scute depends, in addition to the essential build utilities, on the
  176. following packages at build time:
  177. @table @code
  178. @item libgpg-error
  179. Scute uses the GnuPG 2.0 framework for error handling, so it depends on
  180. the GPG error library. The minimum version required is 1.14.
  181. @item libassuan
  182. Scute uses the GnuPG 2.0 framework for communication with the GPG Agent,
  183. so it depends on the Assuan library. The minimum version required is
  184. 2.0.0.
  185. @end table
  186. At run-time, in addition to the run-time versions of the above
  187. libraries, you also need the following packages installed and
  188. configured:
  189. @table @asis
  190. @item GnuPG
  191. Scute uses the GnuPG 2.0 framework to access the OpenPGP card and for
  192. certificate management. The minimum version required is 2.0.0.
  193. @strong{Caution:} A functional installation of GnuPG 2.0 requires a
  194. running GPG Agent process, which must be advertised to the applications
  195. via the @code{GPG_AGENT_INFO} environment variable. Please make sure
  196. that you fulfill this requirement before using Scute in an application,
  197. running the Scute test suite, or preparing certificates as described in
  198. @ref{Certificate Preparation}. @xref{Invoking GPG-AGENT, , , gnupg,
  199. Using the GNU Privacy Guard}, for details on how to run the GPG Agent.
  200. @item Pinentry
  201. Pinentry is a dependency of GnuPG 2.0, so it also needs to be installed
  202. with it.
  203. @item Firefox et al.
  204. Firefox is the first application supported by Scute. In the future,
  205. other applications may be supported. The applications are not
  206. dependencies of Scute, but Scute can not be used stand-alone, so you can
  207. not experience it without an application.
  208. @end table
  209. @node Building the Source
  210. @section Building the Source
  211. Scute does comply to the GNU coding standards and thus can be compiled
  212. and installed according to the generic installation instructions found
  213. in the source package in the file @code{INSTALL}. There are no Scute
  214. specific options to the configure script.
  215. After installation, the @code{scute.so} module file can be found in
  216. the library directory of the installation path.
  217. @node Certificate Preparation
  218. @section Certificate Preparation
  219. To use an OpenPGP card with Scute, it first has to be initialized by
  220. generating or loading a key on the card, see
  221. @uref{http://www.gnupg.org/(en)/howtos/card-howto/en/smartcard-howto.html,
  222. the OpenPGP Card How-To}. Then a certificate has to be created and
  223. imported into GPGSM. This task involves three steps: First, a
  224. certificate signing request (@acronym{CSR}) has to be created that
  225. matches the key on the card. This certificate signing request then has
  226. to be submitted to a certificate authority (@acronym{CA}), which will
  227. create the certificate and send it back to you. At last, the
  228. certificate has to be imported into GPGSM. This section will explain
  229. all of these steps in detail.
  230. Before you start, make sure that the GPG Agent is running, see
  231. @ref{Prerequisites}. There is no need to configure GPGSM, so you can
  232. create a CSR with the command:
  233. @example
  234. $ gpgsm --gen-key > floppy-head.csr
  235. Please select what kind of key you want:
  236. (1) RSA
  237. (2) Existing key
  238. (3) Existing key from card
  239. Your selection? 3
  240. @end example
  241. As we create a certificate for the OpenPGP Card, the option ``@code{[3]
  242. Direct from card}'' should be selected.
  243. @example
  244. Serial number of the card: 355F9746499F0D4B4ECEE4928B007D16
  245. Available keys:
  246. (1) D53137B94C38D9BF6A199706EA6D5253 OPENPGP.1
  247. (2) B0CD1A9DFC3539A1D6A8B851A11C8665 OPENPGP.2
  248. (3) 53DB41052CC590A40B403F3E6350E5DC OPENPGP.3
  249. Your selection? 3
  250. Possible actions for a RSA key:
  251. (1) sign, encrypt
  252. (2) sign
  253. (3) encrypt
  254. Your selection? 2
  255. @end example
  256. The only operation currently supported is client authentication. For
  257. this, the authentication key has to be selected. This is the third key
  258. on the card, so the options ``@code{[3] OPENPGP.3}'' and ``@code{[2]
  259. sign}'' should be chosen. Note that the key usage is only advisory, and
  260. the CA may assign different capabilities.
  261. @example
  262. Enter the X.509 subject name: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
  263. Enter email addresses (end with an empty line):
  264. > floppy.head@@example.org
  265. >
  266. Enter DNS names (optional; end with an empty line):
  267. >
  268. Enter URIs (optional; end with an empty line):
  269. >
  270. Create self-signed certificate? (y/N) n
  271. @end example
  272. As a last step, the common name and e-mail address of the key owner need
  273. to be specified by you. The above are only an example for a fictious
  274. person working at a fictious company. DNS names are only meaningful for
  275. server certificates and thus should be left empty.
  276. We have now entered all required information and gpgsm will display what
  277. it has gathered and ask whether to create the certificate request:
  278. @example
  279. These parameters are used:
  280. Key-Type: card:OPENPGP.3
  281. Key-Length: 1024
  282. Key-Usage: sign
  283. Name-DN: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
  284. Name-Email: floppy.head@@example.org
  285. Proceed with creation? (y/N) y
  286. Now creating certificate request. This may take a while ...
  287. gpgsm: about to sign the CSR for key: &53DB41052CC590A40B403F3E6350E5DC
  288. @end example
  289. GPGSM will now start working on creating the request. During this time
  290. you will be asked once for a passphrase to unprotect the authentication
  291. key on the card. A pop up window will appear to ask for it.
  292. When it is ready, you should see the final notice:
  293. @example
  294. gpgsm: certificate request created
  295. Ready. You should now send this request to your CA.
  296. @end example
  297. Now, you may look at the created request:
  298. @example
  299. $ cat floppy-head.csr
  300. -----BEGIN CERTIFICATE REQUEST-----
  301. MIICCDCCAXECAQAwgYExCzAJBgNVBAYTAlhZMRUwEwYDVQQIEwxTbmFrZSBEZXNl
  302. cnQxEzARBgNVBAcTClNuYWtlIFRvd24xFzAVBgNVBAoTDlNuYWtlIE9pbCwgTHRk
  303. MRcwFQYDVQQLEw5XZWJzZXJ2ZXIgVGVhbTEUMBIGA1UEAxMLRmxvcHB5IEhlYWQw
  304. gaAwDQYJKoZIhvcNAQEBBQADgY4AMIGKAoGBANWaM9YS89AOx3GX1Rua+4DUHwbL
  305. wt0rBYdBddlabMMteVjUcOOhbFMirLpLAi1S8fUXNiy84ysOmFStmvSIXDsAgXq5
  306. 1ESOU4SNg2zEkPDF1WYJ5BFIXdYq9i2k5W7+ctV8PkKv3e5IeYXTa5qppIPD31de
  307. gM8Qj7tK0hL/eNCfAgQAAQABoEUwQwYJKoZIhvcNAQkOMTYwNDAiBgNVHREEGzAZ
  308. gRdmbG9wcHkuaGVhZEBleGFtcGxlLmNvbTAOBgNVHQ8BAf8EBAMCBsAwDQYJKoZI
  309. hvcNAQEFBQADgYEAFC9q6+ib9YGCLB/2AlZR+/dvb+pEeXR1EbpV/dw/gjP1yPY6
  310. 29n8ZIDLUvQvNCtfCcXFxFimVSSB/KmFXXsJbM+NXQyT6Ocn34iHmkf9IVRMWQWg
  311. ZBYfQVeXAd7XlxI6d1wXDLwD/26lTU/rH2JU6H1+zSfZxqwVC4Iu+kiN4Y8=
  312. -----END CERTIFICATE REQUEST-----
  313. $
  314. @end example
  315. The next step is to submit this certificate request to the CA, which can
  316. then create a certificate and send it back to you.
  317. If, for example, you use the CA @uref{http://www.cacert.org, CAcert},
  318. then you can log into your account at the CAcert website, choose
  319. ``Client Certificates -> New'', check ``Show advanced options'', paste
  320. the above request block into the text field and click on ``Submit''.
  321. If everything works correctly, a certificate will be shown, which you
  322. can cut and paste into a new file @file{floppy-head.crt}.
  323. Alternatively if, for example, you set up your own CA with OpenSSL, then
  324. you can create your own certificate by issueing a command similar
  325. @code{openssl ca -in floppy-head.csr -cert snakeoil-ca-rsa.crt -keyfile
  326. snakeoil-ca-rsa.key -out floppy-head.crt}. Please see the OpenSSL
  327. documentation for more details on how to set up and administrate a
  328. certificate authority infrastructure.
  329. In any way you should end up with a certificate file
  330. @file{floppy-head.crt}, which you then have to import into GPGSM. It is
  331. also recommended that you import the root certificate of the CA first in
  332. the same fashion.
  333. @example
  334. $ gpgsm --import floppy-head.crt
  335. gpgsm: certificate imported
  336. gpgsm: total number processed: 1
  337. gpgsm: imported: 1
  338. @end example
  339. gpgsm tells you that it has imported the certificate. It is now
  340. associated with the key you used when creating the request. To see the
  341. content of your certificate, you may now enter:
  342. @example
  343. $ gpgsm -K Floppy
  344. /home/foo/.gnupg/pubring.kbx
  345. ---------------------------
  346. Serial number: 10
  347. Issuer: /CN=Snake Oil CA/OU=Certificate Authority/O=Snake Oil, Ltd/L=Snake Town/ST=Snake Desert/C=XY/EMail=ca@@snakeoil.dom
  348. Subject: /CN=Floppy Head/OU=Webserver Team/O=Snake Oil, Ltd/ST=Snake Desert/C=XY
  349. validity: 2006-11-11 14:09:12 through 2007-11-11 14:09:12
  350. key type: 1024 bit RSA
  351. fingerprint: EC:93:A2:55:C6:58:7F:C9:9E:96:DB:12:6E:64:99:54:BB:E1:94:68
  352. @end example
  353. The option ``@code{-K}'' is used above because this will only list
  354. certificates for which a private key is available. To see more details,
  355. you may use ``@code{--dump-secret-keys}'' instead of ``@code{-K}''.
  356. @node Client Authentication
  357. @chapter Client Authentication
  358. @menu
  359. * Application Configuration:: Preparing the application for use with Scute.
  360. * Authentication With Service:: Using Scute for client authentication.
  361. @end menu
  362. Scute allows you to authenticate yourself to a website securely without
  363. entering a username or password by simply using your OpenPGP card.
  364. Currently, only Mozilla-based browsers like Firefox are supported,
  365. although other applications using Mozilla NSS or supporting PKCS #11
  366. modules may work.
  367. @node Application Configuration
  368. @section Application Configuration
  369. To prepare your application for use with Scute, you have to load the
  370. Scute module as a PKCS #11 module into the application. With Firefox,
  371. this can be done by choosing @code{Edit->Preferences} in the menu. In
  372. the preferences configuration dialog, you should select the
  373. @code{Advanced} configuration section, then the @code{Security} tab, and
  374. then select @code{Security Devices} in the category @code{Certificates}.
  375. @center @image{firefox-pref,13cm}
  376. In the devices manager dialog, you can select @code{Load} to load a new
  377. PKCS #11 device.
  378. @center @image{firefox-dm-load-before,13cm}
  379. In the pop-up dialog that follows, you can give a module name
  380. (e.g. ``@code{Scute}'') and a module filename. The latter should
  381. correspond to the full file name of the installed Scute module file
  382. @file{scute.so}. The default installation path is
  383. @file{/usr/local/lib}, which would mean that you have to provide the
  384. file name @file{/usr/local/lib/scute.so}. If you or your system
  385. administrator installed Scute in a different location, you have to
  386. adjust the file name correspondingly.
  387. @center @image{firefox-dm-load,8cm}
  388. After confirming installation of the security device, a pop-up window
  389. should confirm that the module was successfully loaded, and an entry for
  390. the security device should appear in the device manager list of
  391. @code{Security Modules and Devices}.
  392. @center @image{firefox-dm-load-after,15cm}
  393. When you insert the OpenPGP card for which you generated and imported a
  394. certificate earlier (see @ref{Certificate Preparation}), the device
  395. manager should detect this security token and display some information
  396. about it in the @code{Details} list when you select it from the module
  397. list.
  398. @center @image{firefox-dm-token-present,15cm}
  399. The client certificate will show up in the @code{Certificate Manager}
  400. under @code{Your Certificates}:
  401. @center @image{firefox-cm,13cm}
  402. @node Authentication With Service
  403. @section Authentication With Service
  404. Before you access a web service which requires client authentication,
  405. for instance a fictious web service
  406. @ifnottex
  407. @indicateurl{https://example.com},
  408. @end ifnottex
  409. @iftex
  410. @code{https://example.com},
  411. @end iftex
  412. the OpenPGP card should be present. In this case, a pop-up window will
  413. appear that requests you to enter the PIN number protecting the
  414. authentication key on the OpenPGP card. After entering the PIN number,
  415. your browser will be authenticated to the server. If the server accepts
  416. your request and certificate, this is all which is required. You should
  417. leave the card in the reader as long as the connection persists.
  418. Depending on how aggressively GPG Agent caches your PIN number, you may
  419. have to enter the PIN number again later to keep up the connection to
  420. the server.
  421. If the card is not present, or you enter the wrong PIN, or the server
  422. does not admit your certificate, you will get an error message. This
  423. error message is generated by the application and Scute can not
  424. influence it. Unfortunately, in Firefox (at least up to version
  425. 38.5.0), this error message is not very user friendly. For example,
  426. entering a bad PIN results in the following generic error message, and
  427. the @code{Try Again} button does not work as expected:
  428. @center @image{firefox-bad-pin,11cm}
  429. @comment FIXME: Document possible error codes.
  430. @node Troubleshooting
  431. @chapter Troubleshooting
  432. @strong{Symptom:} Loading the Scute security device in the security
  433. device manager of Firefox fails with "Unable to load module".
  434. @strong{Solution:} Make sure that Scute is correctly installed, and that
  435. all libraries and executables are available. Make sure that the GPG
  436. Agent is running and can be found via the environment variable
  437. @code{GPG_AGENT_INFO}. @xref{Invoking GPG-AGENT, , , gnupg, Using the
  438. GNU Privacy Guard}, for details on how to run the GPG Agent.
  439. @strong{Symptom:} Client authentication fails with "<example.com> has
  440. received an incorrect or unexpected message. Error code: -12227".
  441. @strong{Solution:} Make sure that the correct OpenPGP card is inserted
  442. and the certificate available in GPGSM. Check that the OpenPGP card is
  443. detected correctly in the security device manager and the corresponding
  444. certificate is displayed in the certificate manager of Firefox.
  445. @xref{Authentication With Service}.
  446. @strong{Symptom:} The OpenPGP card is detected and displayed in the
  447. security device manager in Firefox, but no corresponding certificate is
  448. displayed in the certificate manager of Firefox.
  449. @strong{Solution:} Make sure that the corresponding certificate is
  450. imported in GPGSM.
  451. @comment FIXME: Can this really happen???
  452. @node Internals
  453. @chapter Internals
  454. The following notes are intended for people interested in more technical
  455. details about Scute and its implementation. They give an overview about
  456. its scope and potential compatibility issues with applications.
  457. @menu
  458. * Features and Limitations:: Details about the interfaces implemented.
  459. * Developing Scute:: How to understand or improve Scute.
  460. * Mozilla Compatibility:: Interoperability notes for Mozilla NSS.
  461. @end menu
  462. @node Features and Limitations
  463. @section Features and Limitations
  464. Scute implements version 2.20 of the
  465. @uref{http://www.rsasecurity.com/rsalabs/node.asp?id=2133, PKCS #11}
  466. specification.
  467. The @uref{http://www.g10code.com/p-card.html,OpenPGP smart card}
  468. application is supported in read-only mode.
  469. The following functions are not supported:
  470. @table @code
  471. @item C_Initialize
  472. No support for native thread package. Locking callbacks must be
  473. provided if multi-threaded operation is desired.
  474. @item C_WaitForSlotEvent
  475. Not implemented. The interface as specified by PKCS #11 is broken
  476. anyway, as the function can not safely be canceled. Thus, we require
  477. polling.
  478. @item C_GetOperationState
  479. @itemx C_SetOperationState
  480. Not supported.
  481. @item C_InitToken
  482. @itemx C_InitPIN
  483. @itemx C_SetPIN
  484. Not supported. No write operations are allowed. To configure the
  485. token, please use the tools accompanying the GnuPG software suite.
  486. @item C_Login
  487. @itemx C_Logout
  488. Not supported. No login into the token by the software is required.
  489. Passphrase queries are implemented by the use of GPG Agent and Pinentry.
  490. @item C_EncryptInit
  491. @itemx C_Encrypt
  492. @itemx C_EncryptUpdate
  493. @itemx C_EncryptFinal
  494. @itemx C_DigestInit
  495. @itemx C_Digest
  496. @itemx C_DigestUpdate
  497. @itemx C_DigestKey
  498. @itemx C_DigestFinal
  499. @itemx C_VerifyInit
  500. @itemx C_Verify
  501. @itemx C_VerifyUpdate
  502. @itemx C_VerifyFinal
  503. @itemx C_VerifyRecoverInit
  504. @itemx C_VerifyRec
  505. Not supported. Only secret key operations are supported.
  506. @item C_SignInit
  507. @itemx C_Sign
  508. Currently, only signing 36 bytes (MD5+SHA1) hashes is supported (used
  509. for client authentication).
  510. @item C_DecryptInit
  511. @itemx C_Decrypt
  512. Not yet supported, but will be in the future.
  513. @item C_SignUpdate
  514. @itemx C_SignFinal
  515. @itemx C_DecryptUpdate
  516. @itemx C_DecryptFinal
  517. No progressive crypto-operations are supported.
  518. @item C_SignRecoverInit
  519. @itemx C_SignRecover
  520. Not supported.
  521. @item C_DigestEncryptUpdate
  522. @itemx C_DecryptDigestUpdate
  523. @itemx C_SignEncryptUpdate
  524. @itemx C_DecryptVerifyUpdate
  525. Dual-purpose cryptographic functions are not supported.
  526. @item C_GenerateKey
  527. @itemx C_GenerateKeyPair
  528. @itemx C_WrapKey
  529. @itemx C_UnwrapKey
  530. @itemx C_DeriveKey
  531. Key management functions are not supported. Please use the tools
  532. accompanying the GnuPG software suite to generate and import keys for
  533. use with the token.
  534. @item C_SeedRandom
  535. @itemx C_GenerateRandom
  536. Not supported at this point. @code{C_GenerateRandom} may be supported
  537. in the future, though.
  538. @item C_CreateObject
  539. @itemx C_CopyObject
  540. @itemx C_DestroyObject
  541. @itemx C_SetAttributeValue:
  542. Only read-only operations are supported on objects.
  543. @item C_GetObjectSize
  544. Not supported.
  545. @item CKO_CERTIFICATE
  546. The label specifies the key on the card used (e.g. @code{OPENPGP.3}).
  547. The ID is the fingerprint.
  548. @item CKO_PRIVATE_KEY:
  549. The @code{CKA_LOCAL} attribute can not be supported by the OpenPGP card.
  550. It is always set to false (as the key on the card may be copied to the
  551. card from an external source).
  552. @end table
  553. @node Developing Scute
  554. @section Developing Scute
  555. Scute is single-threaded. There is a global lock that is taken in all
  556. entry points of Scute, except for @code{C_Initialize},
  557. @code{C_Finalize}, @code{C_GetFunctionList}, and stubs.
  558. Here are a couple of hints on how to develop PKCS #11 modules for
  559. Mozilla:
  560. @code{libopensc2} ships with a @code{pkcs11-spy} library that can be
  561. loaded as a wrapper around the PKCS #11 library you want to use to log
  562. all functions invoked by Mozilla. Here is how to use it:
  563. Set the @code{PKCS11SPY_OUTPUT} environment variable to a filename.
  564. @code{pkcs11-spy} appends its log messages at the end of this file. Set
  565. the @code{PKCS11SPY} environment variable to the filename of the PKCS
  566. #11 module you actually want to use. Start Mozilla within this
  567. environment.
  568. There is a different, probably more powerful way to debug Mozilla PKCS
  569. #11 libraries. However, to be able to use it, you need to configure and
  570. compile the Mozilla NSS sources with @code{--enable-debug}.
  571. Instructions can be found at:
  572. @uref{http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn2.html}
  573. Here are a couple of links to more information about implementing a
  574. PKCS #11 module for Mozilla:
  575. @table @uref
  576. @item http://docs.sun.com/source/816-6150-10/index.htm
  577. @itemx http://docs.sun.com/source/816-6150-10/pkcs.htm
  578. Implementing PKCS #11 for the Netscape Security Library (Caution: The
  579. content may be out of date)
  580. @item http://www.mozilla.org/projects/security/pki/pkcs11/netscape/problems.html
  581. Common PKCS #11 Implementation Problems
  582. @item http://www.mozilla.org/projects/security/pki/pkcs11/
  583. PKCS #11 Conformance Testing
  584. @item http://www.mozilla.org/projects/security/pki/nss/
  585. The Mozilla NSS web page
  586. @end table
  587. @node Mozilla Compatibility
  588. @section Mozilla Compatibility
  589. Mozilla has a bug that causes the wrong security device to be unloaded
  590. when unloading a security device. Also, the displayed list becomes
  591. corrupt. When closing and reopening the security device manager, the
  592. list displayed is correct, but in anyway the wrong security module is
  593. unloaded.
  594. @include gpl.texi
  595. @node Concept Index
  596. @unnumbered Concept Index
  597. @printindex cp
  598. @summarycontents
  599. @contents
  600. @bye