scute.texi 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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. @item Pinentry
  194. Pinentry is a dependency of GnuPG 2.0, so it also needs to be installed
  195. with it.
  196. @item Firefox et al.
  197. Firefox is the first application supported by Scute. In the future,
  198. other applications may be supported. The applications are not
  199. dependencies of Scute, but Scute can not be used stand-alone, so you can
  200. not experience it without an application.
  201. @end table
  202. @node Building the Source
  203. @section Building the Source
  204. Scute does comply to the GNU coding standards and thus can be compiled
  205. and installed according to the generic installation instructions found
  206. in the source package in the file @code{INSTALL}. There are no Scute
  207. specific options to the configure script.
  208. After installation, the @code{scute.so} module file can be found in
  209. the library directory of the installation path.
  210. @node Certificate Preparation
  211. @section Certificate Preparation
  212. To use an OpenPGP card with Scute, it first has to be initialized by
  213. generating or loading a key on the card, see
  214. @uref{http://www.gnupg.org/(en)/howtos/card-howto/en/smartcard-howto.html,
  215. the OpenPGP Card How-To}. Then a certificate has to be created and
  216. imported into GPGSM. This task involves three steps: First, a
  217. certificate signing request (@acronym{CSR}) has to be created that
  218. matches the key on the card. This certificate signing request then has
  219. to be submitted to a certificate authority (@acronym{CA}), which will
  220. create the certificate and send it back to you. At last, the
  221. certificate has to be imported into GPGSM. This section will explain
  222. all of these steps in detail.
  223. Before you start, make sure that the GPG Agent is running, see
  224. @ref{Prerequisites}. There is no need to configure GPGSM, so you can
  225. create a CSR with the command:
  226. @example
  227. $ gpgsm --gen-key > floppy-head.csr
  228. Please select what kind of key you want:
  229. (1) RSA
  230. (2) Existing key
  231. (3) Existing key from card
  232. Your selection? 3
  233. @end example
  234. As we create a certificate for the OpenPGP Card, the option ``@code{[3]
  235. Direct from card}'' should be selected.
  236. @example
  237. Serial number of the card: 355F9746499F0D4B4ECEE4928B007D16
  238. Available keys:
  239. (1) D53137B94C38D9BF6A199706EA6D5253 OPENPGP.1
  240. (2) B0CD1A9DFC3539A1D6A8B851A11C8665 OPENPGP.2
  241. (3) 53DB41052CC590A40B403F3E6350E5DC OPENPGP.3
  242. Your selection? 3
  243. Possible actions for a RSA key:
  244. (1) sign, encrypt
  245. (2) sign
  246. (3) encrypt
  247. Your selection? 2
  248. @end example
  249. The only operation currently supported is client authentication. For
  250. this, the authentication key has to be selected. This is the third key
  251. on the card, so the options ``@code{[3] OPENPGP.3}'' and ``@code{[2]
  252. sign}'' should be chosen. Note that the key usage is only advisory, and
  253. the CA may assign different capabilities.
  254. @example
  255. Enter the X.509 subject name: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
  256. Enter email addresses (end with an empty line):
  257. > floppy.head@@example.org
  258. >
  259. Enter DNS names (optional; end with an empty line):
  260. >
  261. Enter URIs (optional; end with an empty line):
  262. >
  263. Create self-signed certificate? (y/N) n
  264. @end example
  265. As a last step, the common name and e-mail address of the key owner need
  266. to be specified by you. The above are only an example for a fictious
  267. person working at a fictious company. DNS names are only meaningful for
  268. server certificates and thus should be left empty.
  269. We have now entered all required information and gpgsm will display what
  270. it has gathered and ask whether to create the certificate request:
  271. @example
  272. These parameters are used:
  273. Key-Type: card:OPENPGP.3
  274. Key-Length: 1024
  275. Key-Usage: sign
  276. Name-DN: CN=Floppy Head,OU="Webserver Team",O="Snake Oil, Ltd",L="Snake Town",ST="Snake Desert",C=XY
  277. Name-Email: floppy.head@@example.org
  278. Proceed with creation? (y/N) y
  279. Now creating certificate request. This may take a while ...
  280. gpgsm: about to sign the CSR for key: &53DB41052CC590A40B403F3E6350E5DC
  281. @end example
  282. GPGSM will now start working on creating the request. During this time
  283. you will be asked once for a passphrase to unprotect the authentication
  284. key on the card. A pop up window will appear to ask for it.
  285. When it is ready, you should see the final notice:
  286. @example
  287. gpgsm: certificate request created
  288. Ready. You should now send this request to your CA.
  289. @end example
  290. Now, you may look at the created request:
  291. @example
  292. $ cat floppy-head.csr
  293. -----BEGIN CERTIFICATE REQUEST-----
  294. MIICCDCCAXECAQAwgYExCzAJBgNVBAYTAlhZMRUwEwYDVQQIEwxTbmFrZSBEZXNl
  295. cnQxEzARBgNVBAcTClNuYWtlIFRvd24xFzAVBgNVBAoTDlNuYWtlIE9pbCwgTHRk
  296. MRcwFQYDVQQLEw5XZWJzZXJ2ZXIgVGVhbTEUMBIGA1UEAxMLRmxvcHB5IEhlYWQw
  297. gaAwDQYJKoZIhvcNAQEBBQADgY4AMIGKAoGBANWaM9YS89AOx3GX1Rua+4DUHwbL
  298. wt0rBYdBddlabMMteVjUcOOhbFMirLpLAi1S8fUXNiy84ysOmFStmvSIXDsAgXq5
  299. 1ESOU4SNg2zEkPDF1WYJ5BFIXdYq9i2k5W7+ctV8PkKv3e5IeYXTa5qppIPD31de
  300. gM8Qj7tK0hL/eNCfAgQAAQABoEUwQwYJKoZIhvcNAQkOMTYwNDAiBgNVHREEGzAZ
  301. gRdmbG9wcHkuaGVhZEBleGFtcGxlLmNvbTAOBgNVHQ8BAf8EBAMCBsAwDQYJKoZI
  302. hvcNAQEFBQADgYEAFC9q6+ib9YGCLB/2AlZR+/dvb+pEeXR1EbpV/dw/gjP1yPY6
  303. 29n8ZIDLUvQvNCtfCcXFxFimVSSB/KmFXXsJbM+NXQyT6Ocn34iHmkf9IVRMWQWg
  304. ZBYfQVeXAd7XlxI6d1wXDLwD/26lTU/rH2JU6H1+zSfZxqwVC4Iu+kiN4Y8=
  305. -----END CERTIFICATE REQUEST-----
  306. $
  307. @end example
  308. The next step is to submit this certificate request to the CA, which can
  309. then create a certificate and send it back to you.
  310. If, for example, you use the CA @uref{http://www.cacert.org, CAcert},
  311. then you can log into your account at the CAcert website, choose
  312. ``Client Certificates -> New'', check ``Show advanced options'', paste
  313. the above request block into the text field and click on ``Submit''.
  314. If everything works correctly, a certificate will be shown, which you
  315. can cut and paste into a new file @file{floppy-head.crt}.
  316. Alternatively if, for example, you set up your own CA with OpenSSL, then
  317. you can create your own certificate by issueing a command similar
  318. @code{openssl ca -in floppy-head.csr -cert snakeoil-ca-rsa.crt -keyfile
  319. snakeoil-ca-rsa.key -out floppy-head.crt}. Please see the OpenSSL
  320. documentation for more details on how to set up and administrate a
  321. certificate authority infrastructure.
  322. In any way you should end up with a certificate file
  323. @file{floppy-head.crt}, which you then have to import into GPGSM. It is
  324. also recommended that you import the root certificate of the CA first in
  325. the same fashion.
  326. @example
  327. $ gpgsm --import floppy-head.crt
  328. gpgsm: certificate imported
  329. gpgsm: total number processed: 1
  330. gpgsm: imported: 1
  331. @end example
  332. gpgsm tells you that it has imported the certificate. It is now
  333. associated with the key you used when creating the request. To see the
  334. content of your certificate, you may now enter:
  335. @example
  336. $ gpgsm -K Floppy
  337. /home/foo/.gnupg/pubring.kbx
  338. ---------------------------
  339. Serial number: 10
  340. Issuer: /CN=Snake Oil CA/OU=Certificate Authority/O=Snake Oil, Ltd/L=Snake Town/ST=Snake Desert/C=XY/EMail=ca@@snakeoil.dom
  341. Subject: /CN=Floppy Head/OU=Webserver Team/O=Snake Oil, Ltd/ST=Snake Desert/C=XY
  342. validity: 2006-11-11 14:09:12 through 2007-11-11 14:09:12
  343. key type: 1024 bit RSA
  344. fingerprint: EC:93:A2:55:C6:58:7F:C9:9E:96:DB:12:6E:64:99:54:BB:E1:94:68
  345. @end example
  346. The option ``@code{-K}'' is used above because this will only list
  347. certificates for which a private key is available. To see more details,
  348. you may use ``@code{--dump-secret-keys}'' instead of ``@code{-K}''.
  349. @node Client Authentication
  350. @chapter Client Authentication
  351. @menu
  352. * Application Configuration:: Preparing the application for use with Scute.
  353. * Authentication With Service:: Using Scute for client authentication.
  354. @end menu
  355. Scute allows you to authenticate yourself to a website securely without
  356. entering a username or password by simply using your OpenPGP card.
  357. Currently, only Mozilla-based browsers like Firefox are supported,
  358. although other applications using Mozilla NSS or supporting PKCS #11
  359. modules may work.
  360. @node Application Configuration
  361. @section Application Configuration
  362. To prepare your application for use with Scute, you have to load the
  363. Scute module as a PKCS #11 module into the application. With Firefox,
  364. this can be done by choosing @code{Edit->Preferences} in the menu. In
  365. the preferences configuration dialog, you should select the
  366. @code{Advanced} configuration section, then the @code{Security} tab, and
  367. then select @code{Security Devices} in the category @code{Certificates}.
  368. @center @image{firefox-pref,13cm}
  369. In the devices manager dialog, you can select @code{Load} to load a new
  370. PKCS #11 device.
  371. @center @image{firefox-dm-load-before,13cm}
  372. In the pop-up dialog that follows, you can give a module name
  373. (e.g. ``@code{Scute}'') and a module filename. The latter should
  374. correspond to the full file name of the installed Scute module file
  375. @file{scute.so}. The default installation path is
  376. @file{/usr/local/lib}, which would mean that you have to provide the
  377. file name @file{/usr/local/lib/scute.so}. If you or your system
  378. administrator installed Scute in a different location, you have to
  379. adjust the file name correspondingly.
  380. @center @image{firefox-dm-load,8cm}
  381. After confirming installation of the security device, a pop-up window
  382. should confirm that the module was successfully loaded, and an entry for
  383. the security device should appear in the device manager list of
  384. @code{Security Modules and Devices}.
  385. @center @image{firefox-dm-load-after,15cm}
  386. When you insert the OpenPGP card for which you generated and imported a
  387. certificate earlier (see @ref{Certificate Preparation}), the device
  388. manager should detect this security token and display some information
  389. about it in the @code{Details} list when you select it from the module
  390. list.
  391. @center @image{firefox-dm-token-present,15cm}
  392. The client certificate will show up in the @code{Certificate Manager}
  393. under @code{Your Certificates}:
  394. @center @image{firefox-cm,13cm}
  395. @node Authentication With Service
  396. @section Authentication With Service
  397. Before you access a web service which requires client authentication,
  398. for instance a fictious web service
  399. @ifnottex
  400. @indicateurl{https://example.com},
  401. @end ifnottex
  402. @iftex
  403. @code{https://example.com},
  404. @end iftex
  405. the OpenPGP card should be present. In this case, a pop-up window will
  406. appear that requests you to enter the PIN number protecting the
  407. authentication key on the OpenPGP card. After entering the PIN number,
  408. your browser will be authenticated to the server. If the server accepts
  409. your request and certificate, this is all which is required. You should
  410. leave the card in the reader as long as the connection persists.
  411. Depending on how aggressively GPG Agent caches your PIN number, you may
  412. have to enter the PIN number again later to keep up the connection to
  413. the server.
  414. If the card is not present, or you enter the wrong PIN, or the server
  415. does not admit your certificate, you will get an error message. This
  416. error message is generated by the application and Scute can not
  417. influence it. Unfortunately, in Firefox (at least up to version
  418. 38.5.0), this error message is not very user friendly. For example,
  419. entering a bad PIN results in the following generic error message, and
  420. the @code{Try Again} button does not work as expected:
  421. @center @image{firefox-bad-pin,11cm}
  422. @comment FIXME: Document possible error codes.
  423. @node Troubleshooting
  424. @chapter Troubleshooting
  425. @strong{Symptom:} Loading the Scute security device in the security
  426. device manager of Firefox fails with "Unable to load module".
  427. @strong{Solution:} Make sure that Scute is correctly installed, and that
  428. all libraries and executables are available. Make sure that the GPG
  429. Agent is running and can be found via the environment variable
  430. @code{GPG_AGENT_INFO}. @xref{Invoking GPG-AGENT, , , gnupg, Using the
  431. GNU Privacy Guard}, for details on how to run the GPG Agent.
  432. @strong{Symptom:} Client authentication fails with "<example.com> has
  433. received an incorrect or unexpected message. Error code: -12227".
  434. @strong{Solution:} Make sure that the correct OpenPGP card is inserted
  435. and the certificate available in GPGSM. Check that the OpenPGP card is
  436. detected correctly in the security device manager and the corresponding
  437. certificate is displayed in the certificate manager of Firefox.
  438. @xref{Authentication With Service}.
  439. @strong{Symptom:} The OpenPGP card is detected and displayed in the
  440. security device manager in Firefox, but no corresponding certificate is
  441. displayed in the certificate manager of Firefox.
  442. @strong{Solution:} Make sure that the corresponding certificate is
  443. imported in GPGSM.
  444. @comment FIXME: Can this really happen???
  445. @node Internals
  446. @chapter Internals
  447. The following notes are intended for people interested in more technical
  448. details about Scute and its implementation. They give an overview about
  449. its scope and potential compatibility issues with applications.
  450. @menu
  451. * Features and Limitations:: Details about the interfaces implemented.
  452. * Developing Scute:: How to understand or improve Scute.
  453. * Mozilla Compatibility:: Interoperability notes for Mozilla NSS.
  454. @end menu
  455. @node Features and Limitations
  456. @section Features and Limitations
  457. Scute implements version 2.20 of the
  458. @uref{http://www.rsasecurity.com/rsalabs/node.asp?id=2133, PKCS #11}
  459. specification.
  460. The @uref{http://www.g10code.com/p-card.html,OpenPGP smart card}
  461. application is supported in read-only mode.
  462. The following functions are not supported:
  463. @table @code
  464. @item C_Initialize
  465. No support for native thread package. Locking callbacks must be
  466. provided if multi-threaded operation is desired.
  467. @item C_WaitForSlotEvent
  468. Not implemented. The interface as specified by PKCS #11 is broken
  469. anyway, as the function can not safely be canceled. Thus, we require
  470. polling.
  471. @item C_GetOperationState
  472. @itemx C_SetOperationState
  473. Not supported.
  474. @item C_InitToken
  475. @itemx C_InitPIN
  476. @itemx C_SetPIN
  477. Not supported. No write operations are allowed. To configure the
  478. token, please use the tools accompanying the GnuPG software suite.
  479. @item C_Login
  480. @itemx C_Logout
  481. Not supported. No login into the token by the software is required.
  482. Passphrase queries are implemented by the use of GPG Agent and Pinentry.
  483. @item C_EncryptInit
  484. @itemx C_Encrypt
  485. @itemx C_EncryptUpdate
  486. @itemx C_EncryptFinal
  487. @itemx C_DigestInit
  488. @itemx C_Digest
  489. @itemx C_DigestUpdate
  490. @itemx C_DigestKey
  491. @itemx C_DigestFinal
  492. @itemx C_VerifyInit
  493. @itemx C_Verify
  494. @itemx C_VerifyUpdate
  495. @itemx C_VerifyFinal
  496. @itemx C_VerifyRecoverInit
  497. @itemx C_VerifyRec
  498. Not supported. Only secret key operations are supported.
  499. @item C_SignInit
  500. @itemx C_Sign
  501. Currently, only signing 36 bytes (MD5+SHA1) hashes is supported (used
  502. for client authentication).
  503. @item C_DecryptInit
  504. @itemx C_Decrypt
  505. Not yet supported, but will be in the future.
  506. @item C_SignUpdate
  507. @itemx C_SignFinal
  508. @itemx C_DecryptUpdate
  509. @itemx C_DecryptFinal
  510. No progressive crypto-operations are supported.
  511. @item C_SignRecoverInit
  512. @itemx C_SignRecover
  513. Not supported.
  514. @item C_DigestEncryptUpdate
  515. @itemx C_DecryptDigestUpdate
  516. @itemx C_SignEncryptUpdate
  517. @itemx C_DecryptVerifyUpdate
  518. Dual-purpose cryptographic functions are not supported.
  519. @item C_GenerateKey
  520. @itemx C_GenerateKeyPair
  521. @itemx C_WrapKey
  522. @itemx C_UnwrapKey
  523. @itemx C_DeriveKey
  524. Key management functions are not supported. Please use the tools
  525. accompanying the GnuPG software suite to generate and import keys for
  526. use with the token.
  527. @item C_SeedRandom
  528. @itemx C_GenerateRandom
  529. Not supported at this point. @code{C_GenerateRandom} may be supported
  530. in the future, though.
  531. @item C_CreateObject
  532. @itemx C_CopyObject
  533. @itemx C_DestroyObject
  534. @itemx C_SetAttributeValue:
  535. Only read-only operations are supported on objects.
  536. @item C_GetObjectSize
  537. Not supported.
  538. @item CKO_CERTIFICATE
  539. The label specifies the key on the card used (e.g. @code{OPENPGP.3}).
  540. The ID is the fingerprint.
  541. @item CKO_PRIVATE_KEY:
  542. The @code{CKA_LOCAL} attribute can not be supported by the OpenPGP card.
  543. It is always set to false (as the key on the card may be copied to the
  544. card from an external source).
  545. @end table
  546. @node Developing Scute
  547. @section Developing Scute
  548. Scute is single-threaded. There is a global lock that is taken in all
  549. entry points of Scute, except for @code{C_Initialize},
  550. @code{C_Finalize}, @code{C_GetFunctionList}, and stubs.
  551. Here are a couple of hints on how to develop PKCS #11 modules for
  552. Mozilla:
  553. @code{libopensc2} ships with a @code{pkcs11-spy} library that can be
  554. loaded as a wrapper around the PKCS #11 library you want to use to log
  555. all functions invoked by Mozilla. Here is how to use it:
  556. Set the @code{PKCS11SPY_OUTPUT} environment variable to a filename.
  557. @code{pkcs11-spy} appends its log messages at the end of this file. Set
  558. the @code{PKCS11SPY} environment variable to the filename of the PKCS
  559. #11 module you actually want to use. Start Mozilla within this
  560. environment.
  561. There is a different, probably more powerful way to debug Mozilla PKCS
  562. #11 libraries. However, to be able to use it, you need to configure and
  563. compile the Mozilla NSS sources with @code{--enable-debug}.
  564. Instructions can be found at:
  565. @uref{http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn2.html}
  566. Here are a couple of links to more information about implementing a
  567. PKCS #11 module for Mozilla:
  568. @table @uref
  569. @item http://docs.sun.com/source/816-6150-10/index.htm
  570. @itemx http://docs.sun.com/source/816-6150-10/pkcs.htm
  571. Implementing PKCS #11 for the Netscape Security Library (Caution: The
  572. content may be out of date)
  573. @item http://www.mozilla.org/projects/security/pki/pkcs11/netscape/problems.html
  574. Common PKCS #11 Implementation Problems
  575. @item http://www.mozilla.org/projects/security/pki/pkcs11/
  576. PKCS #11 Conformance Testing
  577. @item http://www.mozilla.org/projects/security/pki/nss/
  578. The Mozilla NSS web page
  579. @end table
  580. @node Mozilla Compatibility
  581. @section Mozilla Compatibility
  582. Mozilla has a bug that causes the wrong security device to be unloaded
  583. when unloading a security device. Also, the displayed list becomes
  584. corrupt. When closing and reopening the security device manager, the
  585. list displayed is correct, but in anyway the wrong security module is
  586. unloaded.
  587. @include gpl.texi
  588. @node Concept Index
  589. @unnumbered Concept Index
  590. @printindex cp
  591. @summarycontents
  592. @contents
  593. @bye