1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4<!ENTITY date SYSTEM "date.xml">
5<!ENTITY version SYSTEM "version.xml">
6]>
7
8<refentry id="signtool">
9
10  <refentryinfo>
11    <date>&date;</date>
12    <title>NSS Security Tools</title>
13    <productname>nss-tools</productname>
14    <productnumber>&version;</productnumber>
15  </refentryinfo>
16
17  <refmeta>
18    <refentrytitle>signtool</refentrytitle>
19    <manvolnum>1</manvolnum>
20  </refmeta>
21
22  <refnamediv>
23    <refname>signtool</refname>
24    <refpurpose>Digitally sign objects and files.</refpurpose>
25  </refnamediv>
26
27  <refsynopsisdiv>
28    <cmdsynopsis>
29      <command>signtool</command>
30      <arg>[-b basename]</arg>
31      <arg>[-c Compression Level] </arg>
32      <arg>[-d cert-dir] </arg>
33      <arg>[-e extension] </arg>
34      <arg>[-f filename] </arg>
35      <arg>[-i installer script] </arg>
36      <arg>[-h]</arg>
37      <arg>[-H]</arg>
38      <arg>[-v]</arg>
39      <arg>[-w]</arg>
40      <arg>[-G nickname]</arg>
41      <arg>[-J]</arg>
42      <arg>[-j directory] </arg>
43      <arg>-k keyName</arg>
44      <arg>[--keysize | -s size]</arg>
45      <arg>[-l]</arg>
46      <arg>[-L]</arg>
47      <arg>[-M]</arg>
48      <arg>[-m metafile] </arg>
49      <arg>[--norecurse] </arg>
50      <arg>[-O] </arg>
51      <arg>[-o] </arg>
52      <arg>[--outfile] </arg>
53      <arg>[-p password] </arg>
54      <arg>[-t|--token tokenname] </arg>
55      <arg>[-z] </arg>
56      <arg>[-X] </arg>
57      <arg>[-x name] </arg>
58      <arg>[--verbose value] </arg>
59      <arg>[--leavearc] </arg>
60      <arg>[-Z jarfile] </arg>
61      <arg>directory-tree</arg>
62      <arg>archive</arg>
63<!-- this isn't the ideal formatting, since docbook can handle reqiored/optional formatting automatically, but let's make it explicit -->
64    </cmdsynopsis>
65  </refsynopsisdiv>
66
67  <refsection>
68    <title>STATUS</title>
69    <para>This documentation is still work in progress. Please contribute to the initial review in <ulink url="https://bugzilla.mozilla.org/show_bug.cgi?id=836477">Mozilla NSS bug 836477</ulink>
70    </para>
71  </refsection>
72
73  <refsection id="description">
74    <title>Description</title>
75
76    <para>The Signing Tool, <command>signtool</command>, creates digital signatures and uses a Java Archive (JAR) file to associate the signatures with files in a directory. Electronic software distribution over any network involves potential security problems. To help address some of these problems, you can associate digital signatures with the files in a JAR archive. Digital signatures allow SSL-enabled clients to perform two important operations:</para>
77    <para>* Confirm the identity of the individual, company, or other entity whose digital signature is associated with the files</para>
78    <para>* Check whether the files have been tampered with since being signed</para>
79    <para>If you have a signing certificate, you can use Netscape Signing Tool to digitally sign files and package them as a JAR file. An object-signing certificate is a special kind of certificate that allows you to associate your digital signature with one or more files.</para>
80    <para>An individual file can potentially be signed with multiple digital signatures. For example, a commercial software developer might sign the files that constitute a software product to prove that the files are indeed from a particular company. A network administrator manager might sign the same files with an additional digital signature based on a company-generated certificate to indicate that the product is approved for use within the company.</para>
81   <para>The significance of a digital signature is comparable to the significance of a handwritten signature. Once you have signed a file, it is difficult to claim later that you didn't sign it. In some situations, a digital signature may be considered as legally binding as a handwritten signature. Therefore, you should take great care to ensure that you can stand behind any file you sign and distribute.</para>
82   <para>For example, if you are a software developer, you should test your code to make sure it is virus-free before signing it. Similarly, if you are a network administrator, you should make sure, before signing any code, that it comes from a reliable source and will run correctly with the software installed on the machines to which you are distributing it.</para>
83    <para>Before you can use Netscape Signing Tool to sign files, you must have an object-signing certificate, which is a special certificate whose associated private key is used to create digital signatures. For testing purposes only, you can create an object-signing certificate with Netscape Signing Tool 1.3. When testing is finished and you are ready to disitribute your software, you should obtain an object-signing certificate from one of two kinds of sources:</para>
84    <para>* An independent certificate authority (CA) that authenticates your identity and charges you a fee. You typically get a certificate from an independent CA if you want to sign software that will be distributed over the Internet.</para>
85    <para>* CA server software running on your corporate intranet or extranet. Netscape Certificate Management System provides a complete management solution for creating, deploying, and managing certificates, including CAs that issue object-signing certificates.</para>
86    <para>You must also have a certificate for the CA that issues your signing certificate before you can sign files. If the certificate authority's certificate isn't already installed in your copy of Communicator, you typically install it by clicking the appropriate link on the certificate authority's web site, for example on the page from which you initiated enrollment for your signing certificate. This is the case for some test certificates, as well as certificates issued by Netscape Certificate Management System: you must download the the CA certificate in addition to obtaining your own signing certificate. CA certificates for several certificate authorities are preinstalled in the Communicator certificate database.</para>
87    <para>When you receive an object-signing certificate for your own use, it is automatically installed in your copy of the Communicator client software. Communicator supports the public-key cryptography standard known as PKCS #12, which governs key portability. You can, for example, move an object-signing certificate and its associated private key from one computer to another on a credit-card-sized device called a smart card.</para>
88  </refsection>
89
90  <refsection id="options">
91    <title>Options</title>
92
93<!-- for the moment, I can't find a way for italics and bold tags to work in varlist entries -->
94    <variablelist>
95      <varlistentry>
96        <term>-b basename</term>
97        <listitem><para>Specifies the base filename for the .rsa and .sf files in the META-INF directory to conform with the JAR format. For example, <emphasis>-b signatures</emphasis> causes the files to be named signatures.rsa and signatures.sf. The default is signtool.</para></listitem>
98      </varlistentry>
99      <varlistentry>
100        <term>-c#</term>
101	<listitem><para>
102	Specifies the compression level for the -J or -Z option. The symbol # represents a number from 0 to 9, where 0 means no compression and 9 means maximum compression. The higher the level of compression, the smaller the output but the longer the operation takes.
103
104If the -c# option is not used with either the -J or the -Z option, the default compression value used by both the -J and -Z options is 6.
105</para></listitem>
106      </varlistentry>
107      <varlistentry>
108        <term>-d certdir</term>
109			<listitem><para>
110	Specifies your certificate database directory; that is, the directory in which you placed your key3.db and cert7.db files. To specify the current directory, use "-d." (including the period).
111
112The Unix version of signtool assumes ~/.netscape unless told otherwise. The NT version of signtool always requires the use of the -d option to specify where the database files are located.
113</para></listitem>
114      </varlistentry>
115      <varlistentry>
116        <term>-e extension</term>
117			<listitem><para>
118	Tells signtool to sign only files with the given extension; for example, use -e".class" to sign only Java class files. Note that with Netscape Signing Tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify multiple file types or classes to include.
119</para></listitem>
120      </varlistentry>
121      <varlistentry>
122        <term>-f commandfile</term>
123			<listitem><para>
124	Specifies a text file containing Netscape Signing Tool options and arguments in keyword=value format. All options and arguments can be expressed through this file. For more information about the syntax used with this file, see "Tips and Techniques".
125</para></listitem>
126      </varlistentry>
127      <varlistentry>
128        <term>-G nickname</term>
129        <listitem><para>
130	Generates a new private-public key pair and corresponding object-signing certificate with the given nickname.
131
132The newly generated keys and certificate are installed into the key and certificate databases in the directory specified by the -d option. With the NT version of Netscape Signing Tool, you must use the -d option with the -G option. With the Unix version of Netscape Signing Tool, omitting the -d option causes the tool to install the keys and certificate in the Communicator key and certificate databases. If you are installing the keys and certificate in the Communicator databases, you must exit Communicator before using this option; otherwise, you risk corrupting the databases. In all cases, the certificate is also output to a file named x509.cacert, which has the MIME-type application/x-x509-ca-cert.
133
134Unlike certificates normally used to sign finished code to be distributed over a network, a test certificate created with -G is not signed by a recognized certificate authority. Instead, it is self-signed. In addition, a single test signing certificate functions as both an object-signing certificate and a CA. When you are using it to sign objects, it behaves like an object-signing certificate. When it is imported into browser software such as Communicator, it behaves like an object-signing CA and cannot be used to sign objects.
135
136The -G option is available in Netscape Signing Tool 1.0 and later versions only. By default, it produces only RSA certificates with 1024-byte keys in the internal token. However, you can use the -s option specify the required key size and the -t option to specify the token.
137        </para></listitem>
138      </varlistentry>
139      <varlistentry>
140        <term>-i scriptname</term>
141        <listitem><para>
142Specifies the name of an installer script for SmartUpdate. This script installs files from the JAR archive in the local system after SmartUpdate has validated the digital signature. For more details, see the description of -m that follows. The -i option provides a straightforward way to provide this information if you don't need to specify any metadata other than an installer script.
143        </para></listitem>
144      </varlistentry>
145      <varlistentry>
146        <term>-J</term>
147        <listitem>
148          <para>
149Signs a directory of HTML files containing JavaScript and creates as many archive files as are specified in the HTML tags. Even if signtool creates more than one archive file, you need to supply the key database password only once.
150
151The -J option is available only in Netscape Signing Tool 1.0 and later versions. The -J option cannot be used at the same time as the -Z option.
152
153If the -c# option is not used with the -J option, the default compression value is 6.
154
155Note that versions 1.1 and later of Netscape Signing Tool correctly recognizes the CODEBASE attribute, allows paths to be expressed for the CLASS and SRC attributes instead of filenames only, processes LINK tags and parses HTML correctly, and offers clearer error messages.
156          </para>
157        </listitem>
158      </varlistentry>
159      <varlistentry>
160        <term>-j directory</term>
161			<listitem><para>
162	Specifies a special JavaScript directory. This option causes the specified directory to be signed and tags its entries as inline JavaScript. This special type of entry does not have to appear in the JAR file itself. Instead, it is located in the HTML page containing the inline scripts. When you use signtool -v, these entries are displayed with the string NOT PRESENT.
163</para></listitem>
164      </varlistentry>
165      <varlistentry>
166        <term>-k key ... directory</term>
167			<listitem><para>
168	Specifies the nickname (key) of the certificate you want to sign with and signs the files in the specified directory. The directory to sign is always specified as the last command-line argument. Thus, it is possible to write
169
170signtool -k MyCert -d . signdir
171
172You may have trouble if the nickname contains a single quotation mark. To avoid problems, escape the quotation mark using the escape conventions for your platform.
173
174It's also possible to use the -k option without signing any files or specifying a directory. For example, you can use it with the -l option to get detailed information about a particular signing certificate.
175</para></listitem>
176      </varlistentry>
177      <varlistentry>
178        <term>-l</term>
179			<listitem><para>
180	Lists signing certificates, including issuing CAs. If any of your certificates are expired or invalid, the list will so specify. This option can be used with the -k option to list detailed information about a particular signing certificate.
181
182The -l option is available in Netscape Signing Tool 1.0 and later versions only.
183</para></listitem>
184      </varlistentry>
185      <varlistentry>
186        <term>-L</term>
187			<listitem><para>
188	Lists the certificates in your database. An asterisk appears to the left of the nickname for any certificate that can be used to sign objects with signtool.
189</para></listitem>
190      </varlistentry>
191      <varlistentry>
192        <term>--leavearc</term>
193			<listitem><para>
194	Retains the temporary .arc (archive) directories that the -J option creates. These directories are automatically erased by default. Retaining the temporary directories can be an aid to debugging.
195</para></listitem>
196      </varlistentry>
197      <varlistentry>
198        <term>-m metafile</term>
199			<listitem><para>
200	Specifies the name of a metadata control file. Metadata is signed information attached either to the JAR archive itself or to files within the archive. This metadata can be any ASCII string, but is used mainly for specifying an installer script.
201
202The metadata file contains one entry per line, each with three fields:
203
204field #1: file specification, or + if you want to specify global metadata (that is, metadata about the JAR archive itself or all entries in the archive)
205field #2: the name of the data you are specifying; for example: Install-Script
206field #3: data corresponding to the name in field #2
207
208For example, the -i option uses the equivalent of this line:
209
210+ Install-Script: script.js
211
212
213This example associates a MIME type with a file:
214
215movie.qt MIME-Type: video/quicktime
216
217For information about the way installer script information appears in the manifest file for a JAR archive, see The JAR Format on Netscape DevEdge.
218</para></listitem>
219      </varlistentry>
220      <varlistentry>
221        <term>-M</term>
222			<listitem><para>
223	Lists the PKCS #11 modules available to signtool, including smart cards.
224
225The -M option is available in Netscape Signing Tool 1.0 and later versions only.
226
227For information on using Netscape Signing Tool with smart cards, see "Using Netscape Signing Tool with Smart Cards".
228
229For information on using the -M option to verify FIPS-140-1 validated mode, see "Netscape Signing Tool and FIPS-140-1".
230</para></listitem>
231      </varlistentry>
232      <varlistentry>
233        <term>--norecurse</term>
234			<listitem><para>
235	Blocks recursion into subdirectories when signing a directory's contents or when parsing HTML.
236</para></listitem>
237      </varlistentry>
238      <varlistentry>
239        <term>-o</term>
240			<listitem><para>
241	Optimizes the archive for size. Use this only if you are signing very large archives containing hundreds of files. This option makes the manifest files (required by the JAR format) considerably smaller, but they contain slightly less information.
242</para></listitem>
243      </varlistentry>
244      <varlistentry>
245        <term>--outfile outputfile</term>
246			<listitem><para>
247	Specifies a file to receive redirected output from Netscape Signing Tool.
248</para></listitem>
249      </varlistentry>
250      <varlistentry>
251        <term>-p password</term>
252			<listitem><para>
253	Specifies a password for the private-key database. Note that the password entered on the command line is displayed as plain text.
254</para></listitem>
255      </varlistentry>
256      <varlistentry>
257        <term>-s keysize</term>
258			<listitem><para>
259	Specifies the size of the key for generated certificate. Use the -M option to find out what tokens are available.
260
261The -s option can be used with the -G option only.
262</para></listitem>
263      </varlistentry>
264      <varlistentry>
265        <term>-t token</term>
266			<listitem><para>
267	Specifies which available token should generate the key and receive the certificate. Use the -M option to find out what tokens are available.
268
269The -t option can be used with the -G option only.
270</para></listitem>
271      </varlistentry>
272      <varlistentry>
273        <term>-v archive</term>
274			<listitem><para>
275	Displays the contents of an archive and verifies the cryptographic integrity of the digital signatures it contains and the files with which they are associated. This includes checking that the certificate for the issuer of the object-signing certificate is listed in the certificate database, that the CA's digital signature on the object-signing certificate is valid, that the relevant certificates have not expired, and so on.
276</para></listitem>
277      </varlistentry>
278      <varlistentry>
279        <term>--verbosity value</term>
280			<listitem><para>
281	Sets the quantity of information Netscape Signing Tool generates in operation. A value of 0 (zero) is the default and gives full information. A value of -1 suppresses most messages, but not error messages.
282</para></listitem>
283      </varlistentry>
284      <varlistentry>
285        <term>-w archive</term>
286			<listitem><para>
287	Displays the names of signers of any files in the archive.
288</para></listitem>
289      </varlistentry>
290      <varlistentry>
291        <term>-x directory</term>
292			<listitem><para>
293	Excludes the specified directory from signing. Note that with Netscape Signing Tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify several particular directories to exclude.
294</para></listitem>
295      </varlistentry>
296      <varlistentry>
297        <term>-z</term>
298			<listitem><para>
299	Tells signtool not to store the signing time in the digital signature. This option is useful if you want the expiration date of the signature checked against the current date and time rather than the time the files were signed.
300</para></listitem>
301      </varlistentry>
302      <varlistentry>
303        <term>-Z jarfile</term>
304			<listitem><para>
305	Creates a JAR file with the specified name. You must specify this option if you want signtool to create the JAR file; it does not do so automatically. If you don't specify -Z, you must use an external ZIP tool to create the JAR file.
306
307The -Z option cannot be used at the same time as the -J option.
308
309If the -c# option is not used with the -Z option, the default compression value is 6.</para></listitem>
310      </varlistentry>
311    </variablelist>
312  </refsection>
313
314  <refsection id="command-file">
315    <title>The Command File Format</title>
316    <para>Entries in a Netscape Signing Tool command file have this general format:
317keyword=value
318
319Everything before the = sign on a single line is a keyword, and everything from the = sign to the end of line is a value. The value may include = signs; only the first = sign on a line is interpreted. Blank lines are ignored, but white space on a line with keywords and values is assumed to be part of the keyword (if it comes before the equal sign) or part of the value (if it comes after the first equal sign). Keywords are case insensitive, values are generally case sensitive. Since the = sign and newline delimit the value, it should not be quoted. </para>
320<!-- i'm working on a decent way to do embedded subsections; for now, just use a bold tag to show a new section -->
321	<para><command>Subsection</command></para>
322	<variablelist>
323		<varlistentry>
324			<term>basename</term>
325			<listitem><para>Same as -b option.</para></listitem>
326      </varlistentry>
327      <varlistentry>
328        <term>compression</term>
329			<listitem><para>
330	Same as -c option.
331</para></listitem>
332      </varlistentry>
333      <varlistentry>
334        <term>certdir</term>
335			<listitem><para>
336	Same as -d option.
337</para></listitem>
338      </varlistentry>
339      <varlistentry>
340        <term>extension</term>
341			<listitem><para>
342	Same as -e option.
343</para></listitem>
344      </varlistentry>
345      <varlistentry>
346        <term>generate</term>
347			<listitem><para>
348	Same as -G option.
349</para></listitem>
350      </varlistentry>
351      <varlistentry>
352        <term>installscript</term>
353			<listitem><para>
354	Same as -i option.
355</para></listitem>
356      </varlistentry>
357      <varlistentry>
358        <term>javascriptdir</term>
359			<listitem><para>
360	Same as -j option.
361</para></listitem>
362      </varlistentry>
363      <varlistentry>
364        <term>htmldir</term>
365			<listitem><para>
366	Same as -J option.
367</para></listitem>
368      </varlistentry>
369      <varlistentry>
370        <term>certname</term>
371			<listitem><para>
372	Nickname of certificate, as with -k and -l -k options.
373</para></listitem>
374      </varlistentry>
375      <varlistentry>
376        <term>signdir</term>
377			<listitem><para>
378	The directory to be signed, as with -k option.
379</para></listitem>
380      </varlistentry>
381      <varlistentry>
382        <term>list</term>
383			<listitem><para>
384	Same as -l option. Value is ignored, but = sign must be present.
385</para></listitem>
386      </varlistentry>
387      <varlistentry>
388        <term>listall</term>
389			<listitem><para>
390	Same as -L option. Value is ignored, but = sign must be present.
391</para></listitem>
392      </varlistentry>
393      <varlistentry>
394        <term>metafile</term>
395			<listitem><para>
396	Same as -m option.
397</para></listitem>
398      </varlistentry>
399      <varlistentry>
400        <term>modules</term>
401			<listitem><para>
402	Same as -M option. Value is ignored, but = sign must be present.
403</para></listitem>
404      </varlistentry>
405      <varlistentry>
406        <term>optimize</term>
407			<listitem><para>
408	Same as -o option. Value is ignored, but = sign must be present.
409</para></listitem>
410      </varlistentry>
411      <varlistentry>
412        <term>password</term>
413			<listitem><para>
414	Same as -p option.
415</para></listitem>
416      </varlistentry>
417      <varlistentry>
418        <term>keysize</term>
419			<listitem><para>
420	Same as -s option.
421</para></listitem>
422      </varlistentry>
423      <varlistentry>
424        <term>token</term>
425			<listitem><para>
426	Same as -t option.
427</para></listitem>
428      </varlistentry>
429      <varlistentry>
430        <term>verify</term>
431			<listitem><para>
432	Same as -v option.
433</para></listitem>
434      </varlistentry>
435      <varlistentry>
436        <term>who</term>
437			<listitem><para>
438	Same as -w option.
439</para></listitem>
440      </varlistentry>
441      <varlistentry>
442        <term>exclude</term>
443			<listitem><para>
444	Same as -x option.
445</para></listitem>
446      </varlistentry>
447      <varlistentry>
448        <term>notime</term>
449			<listitem><para>
450	Same as -z option. value is ignored, but = sign must be present.
451</para></listitem>
452      </varlistentry>
453      <varlistentry>
454        <term>jarfile</term>
455			<listitem><para>
456	Same as -Z option.
457</para></listitem>
458      </varlistentry>
459      <varlistentry>
460        <term>outfile</term>
461			<listitem><para>
462	Name of a file to which output and error messages will be redirected. This option has no command-line equivalent.
463	</para></listitem></varlistentry></variablelist>
464  </refsection>
465
466  <refsection id="examples">
467    <title>Extended Examples</title>
468    <para>The following example will do this and that
469    </para>
470	<para><command>Listing Available Signing Certificates</command></para>
471	<para>You use the -L option to list the nicknames for all available certificates and check which ones are signing certificates.</para>
472<programlisting >signtool -L
473
474using certificate directory: /u/jsmith/.netscape
475S Certificates
476- ------------
477  BBN Certificate Services CA Root 1
478  IBM World Registry CA
479  VeriSign Class 1 CA - Individual Subscriber - VeriSign, Inc.
480  GTE CyberTrust Root CA
481  Uptime Group Plc. Class 4 CA
482* Verisign Object Signing Cert
483  Integrion CA
484  GTE CyberTrust Secure Server CA
485  AT&amp;T Directory Services
486* test object signing cert
487  Uptime Group Plc. Class 1 CA
488  VeriSign Class 1 Primary CA
489- ------------
490
491Certificates that can be used to sign objects have *'s to their left. </programlisting>
492	<para>Two signing certificates are displayed: Verisign Object Signing Cert and test object signing cert.</para>
493	<para>You use the -l option to get a list of signing certificates only, including the signing CA for each.</para>
494<programlisting >signtool -l
495
496using certificate directory: /u/jsmith/.netscape
497Object signing certificates
498---------------------------------------
499
500Verisign Object Signing Cert
501    Issued by: VeriSign, Inc. - Verisign, Inc.
502    Expires: Tue May 19, 1998
503test object signing cert
504    Issued by: test object signing cert (Signtool 1.0 Testing
505Certificate (960187691))
506    Expires: Sun May 17, 1998
507---------------------------------------</programlisting>
508	<para>For a list including CAs, use the <option>-L</option> option.</para>
509
510	<para><command>Signing a File</command></para>
511	<para>1. Create an empty directory.</para>
512<programlisting >mkdir signdir</programlisting>
513
514	<para>2. Put some file into it.</para>
515<programlisting >echo boo > signdir/test.f</programlisting>
516
517	<para>3. Specify the name of your object-signing certificate and sign the directory.</para>
518<programlisting >signtool -k MySignCert -Z testjar.jar signdir
519
520using key "MySignCert"
521using certificate directory: /u/jsmith/.netscape
522Generating signdir/META-INF/manifest.mf file..
523--> test.f
524adding signdir/test.f to testjar.jar
525Generating signtool.sf file..
526Enter Password or Pin for "Communicator Certificate DB":
527
528adding signdir/META-INF/manifest.mf to testjar.jar
529adding signdir/META-INF/signtool.sf to testjar.jar
530adding signdir/META-INF/signtool.rsa to testjar.jar
531
532tree "signdir" signed successfully</programlisting>
533	<para>4. Test the archive you just created.</para>
534<programlisting >signtool -v testjar.jar
535
536using certificate directory: /u/jsmith/.netscape
537archive "testjar.jar" has passed crypto verification.
538           status   path
539     ------------   -------------------
540         verified   test.f</programlisting>
541
542	<para><command>Using Netscape Signing Tool with a ZIP Utility</command></para>
543	<para>To use Netscape Signing Tool with a ZIP utility, you must have the utility in your path environment variable. You should use the zip.exe utility rather than pkzip.exe, which cannot handle long filenames. You can use a ZIP utility instead of the -Z option to package a signed archive into a JAR file after you have signed it:</para>
544<programlisting >cd signdir
545
546  zip -r ../myjar.jar *
547  adding: META-INF/ (stored 0%)
548  adding: META-INF/manifest.mf (deflated 15%)
549  adding: META-INF/signtool.sf (deflated 28%)
550  adding: META-INF/signtool.rsa (stored 0%)
551  adding: text.txt (stored 0%)</programlisting>
552
553	<para><command>Generating the Keys and Certificate</command></para>
554	<para>The signtool option -G generates a new public-private key pair and certificate. It takes the nickname of the new certificate as an argument. The newly generated keys and certificate are installed into the key and certificate databases in the directory specified by the -d option. With the NT version of Netscape Signing Tool, you must use the -d option with the -G option. With the Unix version of Netscape Signing Tool, omitting the -d option causes the tool to install the keys and certificate in the Communicator key and certificate databases. In all cases, the certificate is also output to a file named x509.cacert, which has the MIME-type application/x-x509-ca-cert.</para>
555	<para>Certificates contain standard information about the entity they identify, such as the common name and organization name. Netscape Signing Tool prompts you for this information when you run the command with the -G option. However, all of the requested fields are optional for test certificates. If you do not enter a common name, the tool provides a default name. In the following example, the user input is in boldface:</para>
556<programlisting >signtool -G MyTestCert
557
558using certificate directory: /u/someuser/.netscape
559Enter certificate information. All fields are optional. Acceptable
560characters are numbers, letters, spaces, and apostrophes.
561certificate common name: Test Object Signing Certificate
562organization: Netscape Communications Corp.
563organization unit: Server Products Division
564state or province: California
565country (must be exactly 2 characters): US
566username: someuser
567email address: someuser@netscape.com
568Enter Password or Pin for "Communicator Certificate DB": [Password will not echo]
569generated public/private key pair
570certificate request generated
571certificate has been signed
572certificate "MyTestCert" added to database
573Exported certificate to x509.raw and x509.cacert.</programlisting>
574	<para>The certificate information is read from standard input. Therefore, the information can be read from a file using the redirection operator (&lt;) in some operating systems. To create a file for this purpose, enter each of the seven input fields, in order, on a separate line. Make sure there is a newline character at the end of the last line. Then run signtool with standard input redirected from your file as follows:</para>
575<programlisting >signtool -G MyTestCert inputfile</programlisting>
576	<para>The prompts show up on the screen, but the responses will be automatically read from the file. The password will still be read from the console unless you use the -p option to give the password on the command line.</para>
577
578	<para><command>Using the -M Option to List Smart Cards</command></para>
579	<para>You can use the -M option to list the PKCS #11 modules, including smart cards, that are available to signtool:</para>
580<programlisting >signtool -d "c:\netscape\users\jsmith" -M
581
582using certificate directory: c:\netscape\users\username
583Listing of PKCS11 modules
584-----------------------------------------------
585	1. Netscape Internal PKCS #11 Module
586			  (this module is internally loaded)
587			  slots: 2 slots attached
588			  status: loaded
589	  slot: Communicator Internal Cryptographic Services Version 4.0
590	 token: Communicator Generic Crypto Svcs
591	  slot: Communicator User Private Key and Certificate Services
592	 token: Communicator Certificate DB
593	2. CryptOS
594			  (this is an external module)
595 DLL name: core32
596	 slots: 1 slots attached
597	status: loaded
598	  slot: Litronic 210
599	 token:
600	----------------------------------------------- </programlisting>
601
602	<para><command>Using Netscape Signing Tool and a Smart Card to Sign Files</command></para>
603	<para>The signtool command normally takes an argument of the -k option to specify a signing certificate. To sign with a smart card, you supply only the fully qualified name of the certificate.</para>
604	<para>To see fully qualified certificate names when you run Communicator, click the Security button in Navigator, then click Yours under Certificates in the left frame. Fully qualified names are of the format smart card:certificate, for example "MyCard:My Signing Cert". You use this name with the -k argument as follows:</para>
605<programlisting >signtool -k "MyCard:My Signing Cert" directory</programlisting>
606
607
608	<para><command>Verifying FIPS Mode</command></para>
609	<para>Use the -M option to verify that you are using the FIPS-140-1 module.</para>
610<programlisting >signtool -d "c:\netscape\users\jsmith" -M
611
612using certificate directory: c:\netscape\users\jsmith
613Listing of PKCS11 modules
614-----------------------------------------------
615  1. Netscape Internal PKCS #11 Module
616          (this module is internally loaded)
617          slots: 2 slots attached
618          status: loaded
619    slot: Communicator Internal Cryptographic Services Version 4.0
620   token: Communicator Generic Crypto Svcs
621    slot: Communicator User Private Key and Certificate Services
622   token: Communicator Certificate DB
623-----------------------------------------------</programlisting>
624	<para>This Unix example shows that Netscape Signing Tool is using a FIPS-140-1 module:</para>
625<programlisting >signtool -d "c:\netscape\users\jsmith" -M
626using certificate directory: c:\netscape\users\jsmith
627Enter Password or Pin for "Communicator Certificate DB": [password will not echo]
628Listing of PKCS11 modules
629-----------------------------------------------
6301. Netscape Internal FIPS PKCS #11 Module
631(this module is internally loaded)
632slots: 1 slots attached
633status: loaded
634slot: Netscape Internal FIPS-140-1 Cryptographic Services
635token: Communicator Certificate DB
636-----------------------------------------------</programlisting>
637  </refsection>
638
639  <refsection id="seealso">
640    <title>See Also</title>
641    <para>signver (1)</para>
642
643	<para>The NSS wiki has information on the new database design and how to configure applications to use it.</para>
644	<itemizedlist>
645		<listitem>
646			<para>
647				https://wiki.mozilla.org/NSS_Shared_DB_Howto</para>
648		</listitem>
649		<listitem>
650			<para>
651				https://wiki.mozilla.org/NSS_Shared_DB
652			</para>
653		</listitem>
654	</itemizedlist>
655  </refsection>
656
657<!-- don't change -->
658  <refsection id="resources">
659    <title>Additional Resources</title>
660	<para>For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at <ulink url="http://www.mozilla.org/projects/security/pki/nss/">http://www.mozilla.org/projects/security/pki/nss/</ulink>. The NSS site relates directly to NSS code changes and releases.</para>
661	<para>Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto</para>
662	<para>IRC: Freenode at #dogtag-pki</para>
663  </refsection>
664
665<!-- fill in your name first; keep the other names for reference -->
666  <refsection id="authors">
667    <title>Authors</title>
668    <para>The NSS tools were written and maintained by developers with Netscape, Red Hat,  Sun, Oracle, Mozilla, and Google.</para>
669    <para>
670	Authors: Elio Maldonado &lt;emaldona@redhat.com>, Deon Lackey &lt;dlackey@redhat.com>.
671    </para>
672  </refsection>
673
674<!-- don't change -->
675  <refsection id="license">
676    <title>LICENSE</title>
677    <para>Licensed under the Mozilla Public License, v. 2.0.  If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
678    </para>
679  </refsection>
680
681</refentry>
682