scute.texi 26 KB

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