blob: 81a8d1ffe4ea00817875920db8519ba946ab43fc [file] [log] [blame]
tbell16c34dd2009-05-04 18:28:26 -07001." Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
duke6e45e102007-12-01 00:00:00 +00002." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3."
4." This code is free software; you can redistribute it and/or modify it
5." under the terms of the GNU General Public License version 2 only, as
6." published by the Free Software Foundation.
7."
8." This code is distributed in the hope that it will be useful, but WITHOUT
9." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10." FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11." version 2 for more details (a copy is included in the LICENSE file that
12." accompanied this code).
13."
14." You should have received a copy of the GNU General Public License version
15." 2 along with this work; if not, write to the Free Software Foundation,
16." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17."
18." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
19." CA 95054 USA or visit www.sun.com if you need additional information or
20." have any questions.
21."
tbell16c34dd2009-05-04 18:28:26 -070022.TH jarsigner 1 "04 May 2009"
23." Generated from HTML by html2man (author: Eric Armstrong)
duke6e45e102007-12-01 00:00:00 +000024
25.LP
tbell16c34dd2009-05-04 18:28:26 -070026.SH "Name"
duke6e45e102007-12-01 00:00:00 +000027jarsigner \- JAR Signing and Verification Tool
28.LP
29.RS 3
30
31.LP
32.LP
33Generates signatures for Java ARchive (JAR) files, and verifies the signatures of signed JAR files.
34.LP
35.RE
36.SH "SYNOPSIS"
37.LP
38
39.LP
40.nf
41\f3
42.fl
43\fP\f3jarsigner\fP [ options ] jar\-file alias
44.fl
tbell16c34dd2009-05-04 18:28:26 -070045\f3jarsigner\fP \-verify [ options ] jar\-file [alias...]
duke6e45e102007-12-01 00:00:00 +000046.fl
47.fi
48
49.LP
tbell16c34dd2009-05-04 18:28:26 -070050.LP
51The jarsigner \-verify command can take zero or more keystore alias names after the jar filename. When specified, jarsigner will check that the certificate used to verify each signed entry in the jar file matches one of the keystore aliases. The aliases are defined in the keystore specified by \-keystore, or the default keystore.
52.LP
duke6e45e102007-12-01 00:00:00 +000053.SH "DESCRIPTION"
54.LP
55
56.LP
57.LP
58The \f3jarsigner\fP tool is used for two purposes:
59.LP
60.RS 3
61.TP 3
621.
63to sign Java ARchive (JAR) files, and
64.TP 3
652.
66to verify the signatures and integrity of signed JAR files.
67.RE
68
69.LP
70.LP
tbell16c34dd2009-05-04 18:28:26 -070071The JAR feature enables the packaging of class files, images, sounds, and other digital data in a single file for faster and easier distribution. A tool named jar(1) enables developers to produce JAR files. (Technically, any zip file can also be considered a JAR file, although when created by \f3jar\fP or processed by \f3jarsigner\fP, JAR files also contain a META\-INF/MANIFEST.MF file.)
duke6e45e102007-12-01 00:00:00 +000072.LP
73.LP
74A \f2digital signature\fP is a string of bits that is computed from some data (the data being "signed") and the private key of an entity (a person, company, etc.). Like a handwritten signature, a digital signature has many useful characteristics:
75.LP
76.RS 3
77.TP 2
78o
79Its authenticity can be verified, via a computation that uses the public key corresponding to the private key used to generate the signature.
80.TP 2
81o
82It cannot be forged, assuming the private key is kept secret.
83.TP 2
84o
85It is a function of the data signed and thus can't be claimed to be the signature for other data as well.
86.TP 2
87o
88The signed data cannot be changed; if it is, the signature will no longer verify as being authentic.
89.RE
90
91.LP
92.LP
93In order for an entity's signature to be generated for a file, the entity must first have a public/private key pair associated with it, and also one or more certificates authenticating its public key. A \f2certificate\fP is a digitally signed statement from one entity, saying that the public key of some other entity has a particular value.
94.LP
95.LP
tbell16c34dd2009-05-04 18:28:26 -070096\f3jarsigner\fP uses key and certificate information from a \f2keystore\fP to generate digital signatures for JAR files. A keystore is a database of private keys and their associated X.509 certificate chains authenticating the corresponding public keys. The keytool(1) utility is used to create and administer keystores.
duke6e45e102007-12-01 00:00:00 +000097.LP
98.LP
99\f3jarsigner\fP uses an entity's private key to generate a signature. The signed JAR file contains, among other things, a copy of the certificate from the keystore for the public key corresponding to the private key used to sign the file. \f3jarsigner\fP can verify the digital signature of the signed JAR file using the certificate inside it (in its signature block file).
100.LP
101.LP
tbell16c34dd2009-05-04 18:28:26 -0700102\f3jarsigner\fP can generate signatures that include a timestamp, thus enabling systems/deployer (including Java Plug\-in) to check whether the JAR file was signed while the signing certificate was still valid. In addition, APIs will allow applications to obtain the timestamp information.
duke6e45e102007-12-01 00:00:00 +0000103.LP
104.LP
tbell16c34dd2009-05-04 18:28:26 -0700105At this time, \f3jarsigner\fP can only sign JAR files created by the SDK jar(1) tool or zip files. (JAR files are the same as zip files, except they also have a META\-INF/MANIFEST.MF file. Such a file will automatically be created when \f3jarsigner\fP signs a zip file.)
duke6e45e102007-12-01 00:00:00 +0000106.LP
107.LP
108The default \f3jarsigner\fP behavior is to \f2sign\fP a JAR (or zip) file. Use the \f2\-verify\fP option to instead have it \f2verify\fP a signed JAR file.
109.LP
110.SS
tbell16c34dd2009-05-04 18:28:26 -0700111Keystore Aliases
112.LP
113.RS 3
114
115.LP
116.LP
117All keystore entities are accessed via unique \f2aliases\fP.
118.LP
119.LP
120When using \f3jarsigner\fP to sign a JAR file, you must specify the alias for the keystore entry containing the private key needed to generate the signature. For example, the following will sign the JAR file named "MyJARFile.jar", using the private key associated with the alias "duke" in the keystore named "mystore" in the "working" directory. Since no output file is specified, it overwrites MyJARFile.jar with the signed JAR file.
121.LP
122.nf
123\f3
124.fl
125 jarsigner \-keystore /working/mystore \-storepass myspass
126.fl
127 \-keypass dukekeypasswd MyJARFile.jar duke
128.fl
129\fP
130.fi
131
132.LP
133.LP
134Keystores are protected with a password, so the store password (in this case "myspass") must be specified. You will be prompted for it if you don't specify it on the command line. Similarly, private keys are protected in a keystore with a password, so the private key's password (in this case "dukekeypasswd") must be specified, and you will be prompted for it if you don't specify it on the command line and it isn't the same as the store password.
135.LP
136.RE
137.SS
138Keystore Location
139.LP
140.RS 3
141
142.LP
143.LP
144\f3jarsigner\fP has a \f2\-keystore\fP option for specifying the URL of the keystore to be used. The keystore is by default stored in a file named \f2.keystore\fP in the user's home directory, as determined by the \f2user.home\fP system property. On Solaris systems \f2user.home\fP defaults to the user's home directory.
145.LP
146.LP
147Note that the input stream from the \f2\-keystore\fP option is passed to the \f2KeyStore.load\fP method. If \f2NONE\fP is specified as the URL, then a null stream is passed to the \f2KeyStore.load\fP method. \f2NONE\fP should be specified if the \f2KeyStore\fP is not file\-based, for example, if it resides on a hardware token device.
148.LP
149.RE
150.SS
151Keystore Implementation
152.LP
153.RS 3
154
155.LP
156.LP
157The \f2KeyStore\fP class provided in the \f2java.security\fP package supplies well\-defined interfaces to access and modify the information in a keystore. It is possible for there to be multiple different concrete implementations, where each implementation is that for a particular \f2type\fP of keystore.
158.LP
159.LP
160Currently, there are two command\-line tools that make use of keystore implementations (\f3keytool\fP and \f3jarsigner\fP), and also a GUI\-based tool named \f3Policy Tool\fP. Since \f2KeyStore\fP is publicly available, Java 2 SDK users can write additional security applications that use it.
161.LP
162.LP
163There is a built\-in default implementation, provided by Sun Microsystems. It implements the keystore as a file, utilizing a proprietary keystore type (format) named "JKS". It protects each private key with its individual password, and also protects the integrity of the entire keystore with a (possibly different) password.
164.LP
165.LP
166Keystore implementations are provider\-based. More specifically, the application interfaces supplied by \f2KeyStore\fP are implemented in terms of a "Service Provider Interface" (SPI). That is, there is a corresponding abstract \f2KeystoreSpi\fP class, also in the \f2java.security\fP package, which defines the Service Provider Interface methods that "providers" must implement. (The term "provider" refers to a package or a set of packages that supply a concrete implementation of a subset of services that can be accessed by the Java Security API.) Thus, to provide a keystore implementation, clients must implement a provider and supply a KeystoreSpi subclass implementation, as described in
167.na
168\f2How to Implement a Provider for the Java Cryptography Architecture\fP @
169.fi
170http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/HowToImplAProvider.html.
171.LP
172.LP
173Applications can choose different \f2types\fP of keystore implementations from different providers, using the "getInstance" factory method supplied in the \f2KeyStore\fP class. A keystore type defines the storage and data format of the keystore information, and the algorithms used to protect private keys in the keystore and the integrity of the keystore itself. Keystore implementations of different types are not compatible.
174.LP
175.LP
176\f3keytool\fP works on any file\-based keystore implementation. (It treats the keytore location that is passed to it at the command line as a filename and converts it to a FileInputStream, from which it loads the keystore information.) The \f3jarsigner\fP and \f3policytool\fP tools, on the other hand, can read a keystore from any location that can be specified using a URL.
177.LP
178.LP
179For \f3jarsigner\fP and \f3keytool\fP, you can specify a keystore type at the command line, via the \f2\-storetype\fP option. For \f3Policy Tool\fP, you can specify a keystore type via the "Change Keystore" command in the Edit menu.
180.LP
181.LP
182If you don't explicitly specify a keystore type, the tools choose a keystore implementation based simply on the value of the \f2keystore.type\fP property specified in the security properties file. The security properties file is called \f2java.security\fP, and it resides in the SDK security properties directory, \f2java.home\fP/lib/security, where \f2java.home\fP is the runtime environment's directory (the \f2jre\fP directory in the SDK or the top\-level directory of the Java 2 Runtime Environment).
183.LP
184.LP
185Each tool gets the \f2keystore.type\fP value and then examines all the currently\-installed providers until it finds one that implements keystores of that type. It then uses the keystore implementation from that provider.
186.LP
187.LP
188The \f2KeyStore\fP class defines a static method named \f2getDefaultType\fP that lets applications and applets retrieve the value of the \f2keystore.type\fP property. The following line of code creates an instance of the default keystore type (as specified in the \f2keystore.type\fP property):
189.LP
190.nf
191\f3
192.fl
193 KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
194.fl
195\fP
196.fi
197
198.LP
199.LP
200The default keystore type is "jks" (the proprietary type of the keystore implementation provided by Sun). This is specified by the following line in the security properties file:
201.LP
202.nf
203\f3
204.fl
205 keystore.type=jks
206.fl
207\fP
208.fi
209
210.LP
211.LP
212Note: Case doesn't matter in keystore type designations. For example, "JKS" would be considered the same as "jks".
213.LP
214.LP
215To have the tools utilize a keystore implementation other than the default, change that line to specify a different keystore type. For example, if you have a provider package that supplies a keystore implementation for a keystore type called "pkcs12", change the line to
216.LP
217.nf
218\f3
219.fl
220 keystore.type=pkcs12
221.fl
222\fP
223.fi
224
225.LP
226.LP
227Note that if you us the PKCS#11 provider package, you should refer to the
228.na
229\f2KeyTool and JarSigner\fP @
230.fi
231http://java.sun.com/javase/6/docs/technotes/guides/security/p11guide.html#KeyToolJarSigner section of the Java PKCS#11 Reference Guide for details.
232.LP
233.RE
234.SS
235Supported Algorithms
236.LP
237.RS 3
238
239.LP
240.LP
241By default, \f3jarsigner\fP signs a JAR file using either
242.LP
243.RS 3
244.TP 2
245o
246DSA (Digital Signature Algorithm) with the SHA\-1 digest algorithm, or
247.TP 2
248o
249the RSA algorithm with the SHA\-1 digest algorithm.
250.RE
251
252.LP
253.LP
254That is, if the signer's public and private keys are DSA keys, \f3jarsigner\fP will sign the JAR file using the "SHA1withDSA" algorithm. If the signer's keys are RSA keys, \f3jarsigner\fP will attempt to sign the JAR file using the "SHA1withRSA" algorithm.
255.LP
256.LP
257These default signature algorithms can be overridden using the \f2\-sigalg\fP option.
258.LP
259.RE
260.SS
261The Signed JAR File
262.LP
263.RS 3
264
265.LP
266.LP
267When \f3jarsigner\fP is used to sign a JAR file, the output signed JAR file is exactly the same as the input JAR file, except that it has two additional files placed in the META\-INF directory:
268.LP
269.RS 3
270.TP 2
271o
272a signature file, with a .SF extension, and
273.TP 2
274o
275a signature block file, with a .DSA extension.
276.RE
277
278.LP
279.LP
280The base file names for these two files come from the value of the \f2\-sigFile\fP option. For example, if the option appears as
281.LP
282.nf
283\f3
284.fl
285 \-sigFile MKSIGN
286.fl
287\fP
288.fi
289
290.LP
291.LP
292the files are named "MKSIGN.SF" and "MKSIGN.DSA".
293.LP
294.LP
295If no \f2\-sigfile\fP option appears on the command line, the base file name for the .SF and .DSA files will be the first 8 characters of the alias name specified on the command line, all converted to upper case. If the alias name has fewer than 8 characters, the full alias name is used. If the alias name contains any characters that are not allowed in a signature file name, each such character is converted to an underscore ("_") character in forming the file name. Legal characters include letters, digits, underscores, and hyphens.
296.LP
297\f3The Signature (.SF) File\fP
298.LP
299.RS 3
300
301.LP
302.LP
303A signature file (the .SF file) looks similar to the manifest file that is always included in a JAR file when \f3jarsigner\fP is used to sign the file. That is, for each source file included in the JAR file, the .SF file has three lines, just as in the manifest file, listing the following:
304.LP
305.RS 3
306.TP 2
307o
308the file name,
309.TP 2
310o
311the name of the digest algorithm used (SHA), and
312.TP 2
313o
314a SHA digest value.
315.RE
316
317.LP
318.LP
319In the manifest file, the SHA digest value for each source file is the digest (hash) of the binary data in the source file. In the .SF file, on the other hand, the digest value for a given source file is the hash of the three lines in the manifest file for the source file.
320.LP
321.LP
322The signature file also, by default, includes a header containing a hash of the whole manifest file. The presence of the header enables verification optimization, as described in JAR File Verification.
323.LP
324.RE
325\f3The Signature Block (.DSA) File\fP
326.LP
327.RS 3
328
329.LP
330.LP
331The .SF file is signed and the signature is placed in the .DSA file. The .DSA file also contains, encoded inside it, the certificate or certificate chain from the keystore which authenticates the public key corresponding to the private key used for signing.
332.LP
333.RE
334.RE
335.SS
336Signature Timestamp
337.LP
338.RS 3
339
340.LP
341.LP
342\f2jarsigner\fP tool can now generate and store a signature timestamp when signing a JAR file. In addition, \f2jarsigner\fP supports alternative signing mechanisms. This behavior is optional and is controlled by the user at the time of signing through these options:
343.LP
344.RS 3
345.TP 2
346o
347\f2\-tsa url\fP
348.TP 2
349o
350\f2\-tsacert alias\fP
351.TP 2
352o
353\f2\-altsigner class\fP
354.TP 2
355o
356\f2\-altsignerpath classpathlist\fP
357.RE
358
359.LP
360.LP
361Each of these options is detailed in the Options section below.
362.LP
363.RE
364.SS
365JAR File Verification
366.LP
367.RS 3
368
369.LP
370.LP
371A successful JAR file verification occurs if the signature(s) are valid, and none of the files that were in the JAR file when the signatures were generated have been changed since then. JAR file verification involves the following steps:
372.LP
373.RS 3
374.TP 3
3751.
376Verify the signature of the .SF file itself.
377.LP
378That is, the verification ensures that the signature stored in each signature block (.DSA) file was in fact generated using the private key corresponding to the public key whose certificate (or certificate chain) also appears in the .DSA file. It also ensures that the signature is a valid signature of the corresponding signature (.SF) file, and thus the .SF file has not been tampered with.
379.TP 3
3802.
381Verify the digest listed in each entry in the .SF file with each corresponding section in the manifest.
382.LP
383The .SF file by default includes a header containing a hash of the entire manifest file. When the header is present, then the verification can check to see whether or not the hash in the header indeed matches the hash of the manifest file. If that is the case, verification proceeds to the next step.
384.LP
385If that is not the case, a less optimized verification is required to ensure that the hash in each source file information section in the .SF file equals the hash of its corresponding section in the manifest file (see The Signature (.SF) File).
386.LP
387One reason the hash of the manifest file that is stored in the .SF file header may not equal the hash of the current manifest file would be because one or more files were added to the JAR file (using the \f2jar\fP tool) after the signature (and thus the .SF file) was generated. When the \f2jar\fP tool is used to add files, the manifest file is changed (sections are added to it for the new files), but the .SF file is not. A verification is still considered successful if none of the files that were in the JAR file when the signature was generated have been changed since then, which is the case if the hashes in the non\-header sections of the .SF file equal the hashes of the corresponding sections in the manifest file.
388.TP 3
3893.
390Read each file in the JAR file that has an entry in the .SF file. While reading, compute the file's digest, and then compare the result with the digest for this file in the manifest section. The digests should be the same, or verification fails.
391.RE
392
393.LP
394.LP
395If any serious verification failures occur during the verification process, the process is stopped and a security exception is thrown. It is caught and displayed by \f3jarsigner\fP.
396.LP
397.RE
398.SS
399Multiple Signatures for a JAR File
400.LP
401.RS 3
402
403.LP
404.LP
405A JAR file can be signed by multiple people simply by running the \f3jarsigner\fP tool on the file multiple times, specifying the alias for a different person each time, as in:
406.LP
407.nf
408\f3
409.fl
410 jarsigner myBundle.jar susan
411.fl
412 jarsigner myBundle.jar kevin
413.fl
414\fP
415.fi
416
417.LP
418.LP
419When a JAR file is signed multiple times, there are multiple .SF and .DSA files in the resulting JAR file, one pair for each signature. Thus, in the example above, the output JAR file includes files with the following names:
420.LP
421.nf
422\f3
423.fl
424 SUSAN.SF
425.fl
426 SUSAN.DSA
427.fl
428 KEVIN.SF
429.fl
430 KEVIN.DSA
431.fl
432\fP
433.fi
434
435.LP
436.LP
437Note: It is also possible for a JAR file to have mixed signatures, some generated by the JDK 1.1 \f3javakey\fP tool and others by \f3jarsigner\fP. That is, \f3jarsigner\fP can be used to sign JAR files already previously signed using \f3javakey\fP.
438.LP
439.RE
440.SH "OPTIONS"
441.LP
442
443.LP
444.LP
445The various \f3jarsigner\fP options are listed and described below. Note:
446.LP
447.RS 3
448.TP 2
449o
450All option names are preceded by a minus sign (\-).
451.TP 2
452o
453The options may be provided in any order.
454.TP 2
455o
456Items in italics (option values) represent the actual values that must be supplied.
457.TP 2
458o
459The \f2\-keystore\fP, \f2\-storepass\fP, \f2\-keypass\fP, \f2\-sigfile\fP, \f2\-sigalg\fP, \f2\-digestalg\fP, and \f2\-signedjar\fP options are only relevant when signing a JAR file, not when verifying a signed JAR file. Similarly, an alias is only specified on the command line when signing a JAR file.
460.RE
461
462.LP
463.RS 3
464.TP 3
465\-keystore url
466Specifies the URL that tells the keystore location. This defaults to the file \f2.keystore\fP in the user's home directory, as determined by the "user.home" system property.
467.LP
468A keystore is required when signing, so you must explicitly specify one if the default keystore does not exist (or you want to use one other than the default).
469.LP
470A keystore is \f2not\fP required when verifying, but if one is specified, or the default exists, and the \f2\-verbose\fP option was also specified, additional information is output regarding whether or not any of the certificates used to verify the JAR file are contained in that keystore.
471.LP
472Note: the \f2\-keystore\fP argument can actually be a file name (and path) specification rather than a URL, in which case it will be treated the same as a "file:" URL. That is,
473.nf
474\f3
475.fl
476 \-keystore \fP\f4filePathAndName\fP\f3
477.fl
478\fP
479.fi
480is treated as equivalent to
481.nf
482\f3
483.fl
484 \-keystore file:\fP\f4filePathAndName\fP\f3
485.fl
486\fP
487.fi
488If the Sun PKCS#11 provider has been configured in the \f2java.security\fP security properties file (located in the JRE's \f2$JAVA_HOME/lib/security\fP directory), then keytool and jarsigner can operate on the PKCS#11 token by specifying these options:
489.RS 3
490.TP 2
491o
492\f2\-keystore NONE\fP
493.TP 2
494o
495\f2\-storetype PKCS11\fP
496.RE
497For example, this command lists the contents of the configured PKCS#11 token:
498.RS 3
499
500.LP
501.nf
502\f3
503.fl
504 jarsigner \-keystore NONE \-storetype PKCS11 \-list
505.fl
506
507.fl
508\fP
509.fi
510.RE
511.TP 3
512\-storetype storetype
513Specifies the type of keystore to be instantiated. The default keystore type is the one that is specified as the value of the "keystore.type" property in the security properties file, which is returned by the static \f2getDefaultType\fP method in \f2java.security.KeyStore\fP.
514.LP
515The PIN for a PCKS#11 token can also be specified using the \f2\-storepass\fP option. If none has been specified, keytool and jarsigner will prompt for the token PIN. If the token has a protected authentication path (such as a dedicated PIN\-pad or a biometric reader), then the \f2\-protected\fP option must be specified and no password options can be specified.
516.TP 3
517\-storepass password
518Specifies the password which is required to access the keystore. This is only needed when signing (not verifying) a JAR file. In that case, if a \f2\-storepass\fP option is not provided at the command line, the user is prompted for the password.
519.LP
520Note: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system.
521.TP 3
522\-keypass password
523Specifies the password used to protect the private key of the keystore entry addressed by the alias specified on the command line. The password is required when using \f3jarsigner\fP to sign a JAR file. If no password is provided on the command line, and the required password is different from the store password, the user is prompted for it.
524.LP
525Note: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system. Also, when typing in a password at the password prompt, the password is echoed (displayed exactly as typed), so be careful not to type it in front of anyone.
526.TP 3
527\-sigfile file
528Specifies the base file name to be used for the generated .SF and .DSA files. For example, if \f2file\fP is "DUKESIGN", the generated .SF and .DSA files will be named "DUKESIGN.SF" and "DUKESIGN.DSA", and will be placed in the "META\-INF" directory of the signed JAR file.
529.LP
530The characters in \f2file\fP must come from the set "a\-zA\-Z0\-9_\-". That is, only letters, numbers, underscore, and hyphen characters are allowed. Note: All lowercase characters will be converted to uppercase for the .SF and .DSA file names.
531.LP
532If no \f2\-sigfile\fP option appears on the command line, the base file name for the .SF and .DSA files will be the first 8 characters of the alias name specified on the command line, all converted to upper case. If the alias name has fewer than 8 characters, the full alias name is used. If the alias name contains any characters that are not legal in a signature file name, each such character is converted to an underscore ("_") character in forming the file name.
533.TP 3
534\-sigalg algorithm
535.RS 3
536
537.LP
538Specifies the name of the signature algorithm to use to sign the JAR file.
539.LP
540See
541.na
542\f2Appendix A\fP @
543.fi
544http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA of the Java Cryptography Architecture for a list of standard signature algorithm names. This algorithm must be compatible with the private key used to sign the JAR file. If this option is not specified, SHA1withDSA or SHA1withRSA will be used depending on the type of private key. There must either be a statically installed provider supplying an implementation of the specified algorithm or the user must specify one with the \f2\-providerClass\fP option, otherwise the command will not succeed.
545.LP
546.RE
547.TP 3
548\-digestalg algorithm
549.RS 3
550Specifies the name of the message digest algorithm to use when digesting the entries of a jar file.
551.LP
552See
553.na
554\f2Appendix A\fP @
555.fi
556http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA of the Java Cryptography Architecture for a list of standard message digest algorithm names. If this option is not specified, SHA\-1 will be used. There must either be a statically installed provider supplying an implementation of the specified algorithm or the user must specify one with the \f2\-providerClass\fP option, otherwise the command will not succeed.
557.LP
558.RE
559.TP 3
560\-signedjar file
561Specifies the name to be used for the signed JAR file.
562.LP
563If no name is specified on the command line, the name used is the same as the input JAR file name (the name of the JAR file to be signed); in other words, that file is overwritten with the signed JAR file.
564.TP 3
565\-verify
566If this appears on the command line, the specified JAR file will be verified, not signed. If the verification is successful, "jar verified" will be displayed. If you try to verify an unsigned JAR file, or a JAR file signed with an unsupported algorithm (e.g., RSA when you don't have an RSA provider installed), the following is displayed: "jar is unsigned. (signatures missing or not parsable)"
567.LP
568It is possible to verify JAR files signed using either \f3jarsigner\fP or the JDK 1.1 \f3javakey\fP tool, or both.
569.LP
570For further information on verification, see JAR File Verification.
571.TP 3
572\-certs
573If this appears on the command line, along with the \f2\-verify\fP and \f2\-verbose\fP options, the output includes certificate information for each signer of the JAR file. This information includes
574.RS 3
575.TP 2
576o
577the name of the type of certificate (stored in the .DSA file) that certifies the signer's public key
578.TP 2
579o
580if the certificate is an X.509 certificate (more specifically, an instance of \f2java.security.cert.X509Certificate\fP): the distinguished name of the signer
581.RE
582.LP
583The keystore is also examined. If no keystore value is specified on the command line, the default keystore file (if any) will be checked. If the public key certificate for a signer matches an entry in the keystore, then the following information will also be displayed:
584.RS 3
585.TP 2
586o
587in parentheses, the alias name for the keystore entry for that signer. If the signer actually comes from a JDK 1.1 identity database instead of from a keystore, the alias name will appear in brackets instead of parentheses.
588.RE
589.TP 3
590\-certchain file
591Specifies the certificate chain to be used, if the certificate chain associated with the private key of the keystore entry, addressed by the alias specified on the command line, is not complete. This may happen if the keystore is located on a hardware token where there is not enough capacity to hold a complete certificate chain. The file can be a sequence of X.509 certificates concatenated together, or a single PKCS#7 formatted data block, either in binary encoding format or in printable encoding format (also known as BASE64 encoding) as defined by the Internet RFC 1421 standard.
592.TP 3
593\-verbose
594If this appears on the command line, it indicates "verbose" mode, which causes \f3jarsigner\fP to output extra information as to the progress of the JAR signing or verification.
595.TP 3
596\-internalsf
597In the past, the .DSA (signature block) file generated when a JAR file was signed used to include a complete encoded copy of the .SF file (signature file) also generated. This behavior has been changed. To reduce the overall size of the output JAR file, the .DSA file by default doesn't contain a copy of the .SF file anymore. But if \f2\-internalsf\fP appears on the command line, the old behavior is utilized. \f3This option is mainly useful for testing; in practice, it should not be used, since doing so eliminates a useful optimization.\fP
598.TP 3
599\-sectionsonly
600If this appears on the command line, the .SF file (signature file) generated when a JAR file is signed does \f2not\fP include a header containing a hash of the whole manifest file. It just contains information and hashes related to each individual source file included in the JAR file, as described in The Signature (.SF) File .
601.LP
602By default, this header is added, as an optimization. When the header is present, then whenever the JAR file is verified, the verification can first check to see whether or not the hash in the header indeed matches the hash of the whole manifest file. If so, verification proceeds to the next step. If not, it is necessary to do a less optimized verification that the hash in each source file information section in the .SF file equals the hash of its corresponding section in the manifest file.
603.LP
604For further information, see JAR File Verification.
605.LP
606\f3This option is mainly useful for testing; in practice, it should not be used, since doing so eliminates a useful optimization.\fP
607.TP 3
608\-protected
609Either \f2true\fP or \f2false\fP. This value should be specified as \f2true\fP if a password must be given via a protected authentication path such as a dedicated PIN reader.
610.RE
611.RS 3
612.TP 3
613\-provider provider\-class\-name
614Used to specify the name of cryptographic service provider's master class file when the service provider is not listed in the security properties file, \f2java.security\fP.
615.LP
616Used in conjunction with the \f2\-providerArg\fP \f2ConfigFilePath\fP option, keytool and jarsigner will install the provider dynamically (where \f2ConfigFilePath\fP is the path to the token configuration file). Here's an example of a command to list a PKCS#11 keystore when the Sun PKCS#11 provider has not been configured in the security properties file.
617.RS 3
618
619.LP
620.nf
621\f3
622.fl
623jarsigner \-keystore NONE \-storetype PKCS11 \\
624.fl
625 \-providerClass sun.security.pkcs11.SunPKCS11 \\
626.fl
627 \-providerArg /foo/bar/token.config \\
628.fl
629 \-list
630.fl
631\fP
632.fi
633.RE
634.TP 3
635\-providerName providerName
636If more than one provider has been configured in the \f2java.security\fP security properties file, you can use the \f2\-providerName\fP option to target a specific provider instance. The argument to this option is the name of the provider.
637.LP
638For the Sun PKCS#11 provider, \f2providerName\fP is of the form \f2SunPKCS11\-\fP\f2TokenName\fP, where \f2TokenName\fP is the name suffix that the provider instance has been configured with, as detailed in the
639.na
640\f2configuration attributes table\fP @
641.fi
642http://java.sun.com/javase/6/docs/technotes/guides/security/p11guide.html#ATTRS. For example, the following command lists the contents of the PKCS#11 keystore provider instance with name suffix \f2SmartCard\fP:
643.RS 3
644
645.LP
646.nf
647\f3
648.fl
649jarsigner \-keystore NONE \-storetype PKCS11 \\
650.fl
651 \-providerName SunPKCS11\-SmartCard \\
652.fl
653 \-list
654.fl
655\fP
656.fi
657.RE
658.TP 3
659\-Jjavaoption
660Passes through the specified \f2javaoption\fP string directly to the Java interpreter. (\f3jarsigner\fP is actually a "wrapper" around the interpreter.) This option should not contain any spaces. It is useful for adjusting the execution environment or memory usage. For a list of possible interpreter options, type \f2java \-h\fP or \f2java \-X\fP at the command line.
661.LP
662.TP 3
663\-tsa url
664If \f2"\-tsa http://example.tsa.url"\fP appears on the command line when signing a JAR file then a timestamp is generated for the signature. The URL, \f2http://example.tsa.url\fP, identifies the location of the Time Stamping Authority (TSA). It overrides any URL found via the \f2\-tsacert\fP option. The \f2\-tsa\fP option does not require the TSA's public key certificate to be present in the keystore.
665.LP
666To generate the timestamp, \f2jarsigner\fP communicates with the TSA using the Time\-Stamp Protocol (TSP) defined in
667.na
668\f2RFC 3161\fP @
669.fi
670http://www.ietf.org/rfc/rfc3161.txt. If successful, the timestamp token returned by the TSA is stored along with the signature in the signature block file.
671.LP
672.TP 3
673\-tsacert alias
674If \f2"\-tsacert alias"\fP appears on the command line when signing a JAR file then a timestamp is generated for the signature. The \f2alias\fP identifies the TSA's public key certificate in the keystore that is currently in effect. The entry's certificate is examined for a Subject Information Access extension that contains a URL identifying the location of the TSA.
675.LP
676The TSA's public key certificate must be present in the keystore when using \f2\-tsacert\fP.
677.LP
678.TP 3
679\-altsigner class
680Specifies that an alternative signing mechanism be used. The fully\-qualified class name identifies a class file that extends the \f2com.sun.jarsigner.ContentSigner abstract class\fP. The path to this class file is defined by the \f2\-altsignerpath\fP option. If the \f2\-altsigner\fP option is used, \f2jarsigner\fP uses the signing mechanism provided by the specified class. Otherwise, \f2jarsigner\fP uses its default signing mechanism.
681.LP
682For example, to use the signing mechanism provided by a class named \f2com.sun.sun.jarsigner.AuthSigner\fP, use the \f2jarsigner\fP option \f2"\-altsigner com.sun.jarsigner.AuthSigner"\fP
683.LP
684.TP 3
685\-altsignerpath classpathlist
686Specifies the path to the class file (the class file name is specified with the \f2\-altsigner\fP option described above) and any JAR files it depends on. If the class file is in a JAR file, then this specifies the path to that JAR file, as shown in the example below.
687.LP
688An absolute path or a path relative to the current directory may be specified. If \f2classpathlist\fP contains multiple paths or JAR files, they should be separated with a colon (\f2:\fP) on Solaris and a semi\-colon (\f2;\fP) on Windows. This option is not necessary if the class is already in the search path.
689.LP
690Example of specifying the path to a jar file that contains the class file:
691.RS 3
692
693.LP
694.LP
695\f2\-altsignerpath /home/user/lib/authsigner.jar\fP
696.LP
697.RE
698.LP
699Note that the JAR file name is included.
700.LP
701Example of specifying the path to the jar file that contains the class file:
702.RS 3
703.LP
704\f2\-altsignerpath /home/user/classes/com/sun/tools/jarsigner/\fP
705.LP
706.RE
707.LP
708Note that the JAR file name is omitted.
709.TP 3
710\-strict
711During the signing or verifying process, some warning messages may be shown. If this option appears on the command line, the exit code of the tool will reflect the warning messages that are found. Read the "WARNINGS" section for details.
712.TP 3
713\-verbose:sub\-options
714For the verifying process, the \f2\-verbose\fP option takes sub\-options to determine how much information will be shown. If \f2\-certs\fP is also specified, the default mode (or sub\-option all) displays each entry as it is being processed and following that, the certificate information for each signer of the JAR file. If \f2\-certs\fP and the \f2\-verbose:grouped\fP sub\-option are specified, entries with the same signer info are grouped and displayed together along with their certificate information. If \f2\-certs\fP and the \f2\-verbose:summary\fP sub\-option are specified, then entries with the same signer info are grouped and displayed together along with their certificate information but details about each entry are summarized and displayed as "one entry (and more)". See the examples section for more information.
715.RE
716.SH "EXAMPLES"
717.LP
718
719.LP
720.SS
721Signing a JAR File
722.LP
723.RS 3
724
725.LP
726.LP
727Suppose you have a JAR file named "bundle.jar" and you'd like to sign it using the private key of the user whose keystore alias is "jane" in the keystore named "mystore" in the "working" directory. Suppose the keystore password is "myspass" and the password for \f2jane\fP's private key is "j638klm". You can use the following to sign the JAR file and name the signed JAR file "sbundle.jar":
728.LP
729.nf
730\f3
731.fl
732 jarsigner \-keystore /working/mystore \-storepass myspass
733.fl
734 \-keypass j638klm \-signedjar sbundle.jar bundle.jar jane
735.fl
736\fP
737.fi
738
739.LP
740.LP
741Note that there is no \f2\-sigfile\fP specified in the command above, so the generated .SF and .DSA files to be placed in the signed JAR file will have default names based on the alias name. That is, they will be named \f2JANE.SF\fP and \f2JANE.DSA\fP.
742.LP
743.LP
744If you want to be prompted for the store password and the private key password, you could shorten the above command to
745.LP
746.nf
747\f3
748.fl
749 jarsigner \-keystore /working/mystore
750.fl
751 \-signedjar sbundle.jar bundle.jar jane
752.fl
753\fP
754.fi
755
756.LP
757.LP
758If the keystore to be used is the default keystore (the one named ".keystore" in your home directory), you don't need to specify a keystore, as in:
759.LP
760.nf
761\f3
762.fl
763 jarsigner \-signedjar sbundle.jar bundle.jar jane
764.fl
765\fP
766.fi
767
768.LP
769.LP
770Finally, if you want the signed JAR file to simply overwrite the input JAR file (\f2bundle.jar\fP), you don't need to specify a \f2\-signedjar\fP option:
771.LP
772.nf
773\f3
774.fl
775 jarsigner bundle.jar jane
776.fl
777\fP
778.fi
779.RE
780
781.LP
782.SS
783Verifying a Signed JAR File
784.LP
785.RS 3
786
787.LP
788.LP
789To verify a signed JAR file, that is, to verify that the signature is valid and the JAR file has not been tampered with, use a command such as the following:
790.LP
791.nf
792\f3
793.fl
794 jarsigner \-verify sbundle.jar
795.fl
796\fP
797.fi
798
799.LP
800.LP
801If the verification is successful,
802.LP
803.nf
804\f3
805.fl
806 jar verified.
807.fl
808\fP
809.fi
810
811.LP
812.LP
813is displayed. Otherwise, an error message appears.
814.LP
815.LP
816You can get more information if you use the \f2\-verbose\fP option. A sample use of \f3jarsigner\fP with the \f2\-verbose\fP option is shown below, along with sample output:
817.LP
818.nf
819\f3
820.fl
821 jarsigner \-verify \-verbose sbundle.jar
822.fl
823
824.fl
825 198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
826.fl
827 199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
828.fl
829 1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
830.fl
831 smk 2752 Fri Sep 26 16:12:30 PDT 1997 AclEx.class
832.fl
833 smk 849 Fri Sep 26 16:12:46 PDT 1997 test.class
834.fl
835
836.fl
837 s = signature was verified
838.fl
839 m = entry is listed in manifest
840.fl
841 k = at least one certificate was found in keystore
842.fl
843
844.fl
845 jar verified.
846.fl
847\fP
848.fi
849
850.LP
851.SS
852Verification with Certificate Information
853.LP
854.LP
855If you specify the \f2\-certs\fP option when verifying, along with the \f2\-verify\fP and \f2\-verbose\fP options, the output includes certificate information for each signer of the JAR file, including the certificate type, the signer distinguished name information (iff it's an X.509 certificate), and, in parentheses, the keystore alias for the signer if the public key certificate in the JAR file matches that in a keystore entry. For example,
856.LP
857.nf
858\f3
859.fl
860 jarsigner \-keystore /working/mystore \-verify \-verbose \-certs myTest.jar
861.fl
862
863.fl
864 198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
865.fl
866 199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
867.fl
868 1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
869.fl
870 208 Fri Sep 26 16:23:30 PDT 1997 META\-INF/JAVATEST.SF
871.fl
872 1087 Fri Sep 26 16:23:30 PDT 1997 META\-INF/JAVATEST.DSA
873.fl
874 smk 2752 Fri Sep 26 16:12:30 PDT 1997 Tst.class
875.fl
876
877.fl
878 X.509, CN=Test Group, OU=Java Software, O=Sun Microsystems, L=CUP, S=CA, C=US (javatest)
879.fl
880 X.509, CN=Jane Smith, OU=Java Software, O=Sun, L=cup, S=ca, C=us (jane)
881.fl
882
883.fl
884 s = signature was verified
885.fl
886 m = entry is listed in manifest
887.fl
888 k = at least one certificate was found in keystore
889.fl
890
891.fl
892 jar verified.
893.fl
894\fP
895.fi
896
897.LP
898.LP
899If the certificate for a signer is not an X.509 certificate, there is no distinguished name information. In that case, just the certificate type and the alias are shown. For example, if the certificate is a PGP certificate, and the alias is "bob", you'd get
900.LP
901.nf
902\f3
903.fl
904 PGP, (bob)
905.fl
906\fP
907.fi
908
909.LP
910.SS
911Verification of a JAR File that Includes Identity Database Signers
912.LP
913.LP
914If a JAR file has been signed using the JDK 1.1 \f3javakey\fP tool, and thus the signer is an alias in an identity database, the verification output includes an "i" symbol. If the JAR file has been signed by both an alias in an identity database and an alias in a keystore, both "k" and "i" appear.
915.LP
916.LP
917When the \f2\-certs\fP option is used, any identity database aliases are shown in square brackets rather than the parentheses used for keystore aliases. For example:
918.LP
919.nf
920\f3
921.fl
922 jarsigner \-keystore /working/mystore \-verify \-verbose \-certs writeFile.jar
923.fl
924
925.fl
926 198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
927.fl
928 199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
929.fl
930 1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
931.fl
932 199 Fri Sep 27 12:22:30 PDT 1997 META\-INF/DUKE.SF
933.fl
934 1013 Fri Sep 27 12:22:30 PDT 1997 META\-INF/DUKE.DSA
935.fl
936 smki 2752 Fri Sep 26 16:12:30 PDT 1997 writeFile.html
937.fl
938
939.fl
940 X.509, CN=Jane Smith, OU=Java Software, O=Sun, L=cup, S=ca, C=us (jane)
941.fl
942 X.509, CN=Duke, OU=Java Software, O=Sun, L=cup, S=ca, C=us [duke]
943.fl
944
945.fl
946 s = signature was verified
947.fl
948 m = entry is listed in manifest
949.fl
950 k = at least one certificate was found in keystore
951.fl
952 i = at least one certificate was found in identity scope
953.fl
954
955.fl
956 jar verified.
957.fl
958\fP
959.fi
960
961.LP
962.LP
963Note that the alias "duke" is in brackets to denote that it is an identity database alias, not a keystore alias.
964.LP
965.RE
966.SH "WARNINGS"
967.LP
968
969.LP
970During the signing/verifying process, jarsigner may display various warnings. These warning codes are defined as follows:
971.nf
972\f3
973.fl
974 hasExpiringCert 2
975.fl
976 This jar contains entries whose signer certificate will expire within six months
977.fl
978
979.fl
980 hasExpiredCert 4
981.fl
982 This jar contains entries whose signer certificate has expired.
983.fl
984
985.fl
986 notYetValidCert 4
987.fl
988 This jar contains entries whose signer certificate is not yet valid.
989.fl
990
991.fl
992 chainNotValidated 4
993.fl
994 This jar contains entries whose certificate chain cannot be correctly validated.
995.fl
996
997.fl
998 badKeyUsage 8
999.fl
1000 This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing.
1001.fl
1002
1003.fl
1004 badExtendedKeyUsage 8
1005.fl
1006 This jar contains entries whose signer certificate's ExtendedKeyUsage extension
1007.fl
1008 doesn't allow code signing.
1009.fl
1010
1011.fl
1012 badNetscapeCertType 8
1013.fl
1014 This jar contains entries whose signer certificate's NetscapeCertType extension
1015.fl
1016 doesn't allow code signing.
1017.fl
1018
1019.fl
1020 hasUnsignedEntry 16
1021.fl
1022 This jar contains unsigned entries which have not been integrity\-checked.
1023.fl
1024
1025.fl
1026 notSignedByAlias 32
1027.fl
1028 This jar contains signed entries which are not signed by the specified alias(es)
1029.fl
1030
1031.fl
1032 aliasNotInStore 32
1033.fl
1034 This jar contains signed entries that are not signed by alias in this keystore
1035.fl
1036
1037.fl
1038\fP
1039.fi
1040
1041.LP
1042.LP
1043When the \f2\-strict\fP option is provided, an OR\-value of warnings detected will be returned as the exit code of the tool. For example, if a certificate used to sign an entry is expired and has a keyUsage extension that does not allow it to sign a file, an exit code 12 (=4+8) will be returned.
1044.LP
1045.LP
1046\f3Note\fP: Exit codes are reused because only 0\-255 is legal for Unix. In any case, if the signing/verifying process fails, the exit code
1047.LP
1048.nf
1049\f3
1050.fl
1051failure 1
1052.fl
1053\fP
1054.fi
1055
1056.LP
1057will be returned.
1058.SS
duke6e45e102007-12-01 00:00:00 +00001059Compatibility with JDK 1.1
1060.LP
1061.RS 3
1062
1063.LP
1064.LP
1065The \f3keytool\fP and \f3jarsigner\fP tools completely replace the \f3javakey\fP tool provided in JDK 1.1. These new tools provide more features than \f3javakey\fP, including the ability to protect the keystore and private keys with passwords, and the ability to verify signatures in addition to generating them.
1066.LP
1067.LP
1068The new keystore architecture replaces the identity database that \f3javakey\fP created and managed. There is no backwards compatibility between the keystore format and the database format used by \f3javakey\fP in 1.1. However,
1069.LP
1070.RS 3
1071.TP 2
1072o
1073It is possible to import the information from an identity database into a keystore, via the \f3keytool\fP \f2\-identitydb\fP command.
1074.TP 2
1075o
1076\f3jarsigner\fP can sign JAR files also previously signed using \f3javakey\fP.
1077.TP 2
1078o
1079\f3jarsigner\fP can verify JAR files signed using \f3javakey\fP. Thus, it recognizes and can work with signer aliases that are from a JDK 1.1 identity database rather than a Java 2 SDK keystore.
1080.RE
1081
1082.LP
1083.LP
1084The following table explains how JAR files that were signed in JDK 1.1.x are treated in the Java 2 platform.
1085.LP
1086.LP
1087.TS
1088.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
1089.de 35
1090.ps \n(.s
1091.vs \n(.vu
1092.in \n(.iu
1093.if \n(.u .fi
1094.if \n(.j .ad
1095.if \n(.j=0 .na
1096..
1097.nf
1098.nr #~ 0
1099.if n .nr #~ 0.6n
1100.ds #d .d
1101.if \(ts\n(.z\(ts\(ts .ds #d nl
1102.fc
1103.nr 33 \n(.s
1104.rm 80 81 82 83 84
1105.nr 34 \n(.lu
1106.eo
1107.am 82
1108.br
1109.di a+
1110.35
1111.ft \n(.f
1112.ll \n(34u*1u/6u
1113.if \n(.l<\n(82 .ll \n(82u
1114.in 0
1115\f3Trusted Identity imported into Java 2 Platform keystore from 1.1 database (4)\fP
1116.br
1117.di
1118.nr a| \n(dn
1119.nr a- \n(dl
1120..
1121.ec \
1122.eo
1123.am 83
1124.br
1125.di b+
1126.35
1127.ft \n(.f
1128.ll \n(34u*1u/6u
1129.if \n(.l<\n(83 .ll \n(83u
1130.in 0
1131\f3Policy File grants privileges to Identity/Alias\fP
1132.br
1133.di
1134.nr b| \n(dn
1135.nr b- \n(dl
1136..
1137.ec \
1138.eo
1139.am 84
1140.br
1141.di c+
1142.35
1143.ft \n(.f
1144.ll \n(34u*1u/6u
1145.if \n(.l<\n(84 .ll \n(84u
1146.in 0
1147Default privileges granted to all code.
1148.br
1149.di
1150.nr c| \n(dn
1151.nr c- \n(dl
1152..
1153.ec \
1154.eo
1155.am 84
1156.br
1157.di d+
1158.35
1159.ft \n(.f
1160.ll \n(34u*1u/6u
1161.if \n(.l<\n(84 .ll \n(84u
1162.in 0
1163Default privileges granted to all code.
1164.br
1165.di
1166.nr d| \n(dn
1167.nr d- \n(dl
1168..
1169.ec \
1170.eo
1171.am 84
1172.br
1173.di e+
1174.35
1175.ft \n(.f
1176.ll \n(34u*1u/6u
1177.if \n(.l<\n(84 .ll \n(84u
1178.in 0
1179Default privileges granted to all code.
1180.br
1181.di
1182.nr e| \n(dn
1183.nr e- \n(dl
1184..
1185.ec \
1186.eo
1187.am 84
1188.br
1189.di f+
1190.35
1191.ft \n(.f
1192.ll \n(34u*1u/6u
1193.if \n(.l<\n(84 .ll \n(84u
1194.in 0
1195Default privileges granted to all code. (3)
1196.br
1197.di
1198.nr f| \n(dn
1199.nr f- \n(dl
1200..
1201.ec \
1202.eo
1203.am 84
1204.br
1205.di g+
1206.35
1207.ft \n(.f
1208.ll \n(34u*1u/6u
1209.if \n(.l<\n(84 .ll \n(84u
1210.in 0
1211Default privileges granted to all code. (1,3)
1212.br
1213.di
1214.nr g| \n(dn
1215.nr g- \n(dl
1216..
1217.ec \
1218.eo
1219.am 84
1220.br
1221.di h+
1222.35
1223.ft \n(.f
1224.ll \n(34u*1u/6u
1225.if \n(.l<\n(84 .ll \n(84u
1226.in 0
1227Default privileges granted to all code plus privileges granted in policy file.
1228.br
1229.di
1230.nr h| \n(dn
1231.nr h- \n(dl
1232..
1233.ec \
1234.eo
1235.am 84
1236.br
1237.di i+
1238.35
1239.ft \n(.f
1240.ll \n(34u*1u/6u
1241.if \n(.l<\n(84 .ll \n(84u
1242.in 0
1243Default privileges granted to all code plus privileges granted in policy file. (2)
1244.br
1245.di
1246.nr i| \n(dn
1247.nr i- \n(dl
1248..
1249.ec \
1250.35
1251.nf
1252.ll \n(34u
1253.nr 80 0
1254.nr 38 \w\f3JAR File Type\fP
1255.if \n(80<\n(38 .nr 80 \n(38
1256.nr 38 \wSigned JAR
1257.if \n(80<\n(38 .nr 80 \n(38
1258.nr 38 \wUnsigned JAR
1259.if \n(80<\n(38 .nr 80 \n(38
1260.nr 38 \wSigned JAR
1261.if \n(80<\n(38 .nr 80 \n(38
1262.nr 38 \wSigned JAR
1263.if \n(80<\n(38 .nr 80 \n(38
1264.nr 38 \wSigned JAR
1265.if \n(80<\n(38 .nr 80 \n(38
1266.nr 38 \wSigned JAR
1267.if \n(80<\n(38 .nr 80 \n(38
1268.nr 38 \wSigned JAR
1269.if \n(80<\n(38 .nr 80 \n(38
1270.nr 38 \wSigned JAR
1271.if \n(80<\n(38 .nr 80 \n(38
1272.nr 38 \wSigned JAR
1273.if \n(80<\n(38 .nr 80 \n(38
1274.nr 38 \wSigned JAR
1275.if \n(80<\n(38 .nr 80 \n(38
1276.80
1277.rm 80
1278.nr 81 0
1279.nr 38 \w\f3Identity in 1.1 database\fP
1280.if \n(81<\n(38 .nr 81 \n(38
1281.nr 38 \wNO
1282.if \n(81<\n(38 .nr 81 \n(38
1283.nr 38 \wNO
1284.if \n(81<\n(38 .nr 81 \n(38
1285.nr 38 \wNO
1286.if \n(81<\n(38 .nr 81 \n(38
1287.nr 38 \wYES/Untrusted
1288.if \n(81<\n(38 .nr 81 \n(38
1289.nr 38 \wYES/Untrusted
1290.if \n(81<\n(38 .nr 81 \n(38
1291.nr 38 \wNO
1292.if \n(81<\n(38 .nr 81 \n(38
1293.nr 38 \wYES/Trusted
1294.if \n(81<\n(38 .nr 81 \n(38
1295.nr 38 \wYES/Trusted
1296.if \n(81<\n(38 .nr 81 \n(38
1297.nr 38 \wYES/Trusted
1298.if \n(81<\n(38 .nr 81 \n(38
1299.nr 38 \wYES/Trusted
1300.if \n(81<\n(38 .nr 81 \n(38
1301.81
1302.rm 81
1303.nr 82 0
1304.nr 38 \wNO
1305.if \n(82<\n(38 .nr 82 \n(38
1306.nr 38 \wNO
1307.if \n(82<\n(38 .nr 82 \n(38
1308.nr 38 \wYES
1309.if \n(82<\n(38 .nr 82 \n(38
1310.nr 38 \wNO
1311.if \n(82<\n(38 .nr 82 \n(38
1312.nr 38 \wNO
1313.if \n(82<\n(38 .nr 82 \n(38
1314.nr 38 \wYES
1315.if \n(82<\n(38 .nr 82 \n(38
1316.nr 38 \wYES
1317.if \n(82<\n(38 .nr 82 \n(38
1318.nr 38 \wNO
1319.if \n(82<\n(38 .nr 82 \n(38
1320.nr 38 \wYES
1321.if \n(82<\n(38 .nr 82 \n(38
1322.nr 38 \wNO
1323.if \n(82<\n(38 .nr 82 \n(38
1324.82
1325.rm 82
1326.nr 38 \n(a-
1327.if \n(82<\n(38 .nr 82 \n(38
1328.nr 83 0
1329.nr 38 \wNO
1330.if \n(83<\n(38 .nr 83 \n(38
1331.nr 38 \wNO
1332.if \n(83<\n(38 .nr 83 \n(38
1333.nr 38 \wNO
1334.if \n(83<\n(38 .nr 83 \n(38
1335.nr 38 \wNO
1336.if \n(83<\n(38 .nr 83 \n(38
1337.nr 38 \wYES
1338.if \n(83<\n(38 .nr 83 \n(38
1339.nr 38 \wYES
1340.if \n(83<\n(38 .nr 83 \n(38
1341.nr 38 \wYES
1342.if \n(83<\n(38 .nr 83 \n(38
1343.nr 38 \wNO
1344.if \n(83<\n(38 .nr 83 \n(38
1345.nr 38 \wNO
1346.if \n(83<\n(38 .nr 83 \n(38
1347.nr 38 \wYES
1348.if \n(83<\n(38 .nr 83 \n(38
1349.83
1350.rm 83
1351.nr 38 \n(b-
1352.if \n(83<\n(38 .nr 83 \n(38
1353.nr 84 0
1354.nr 38 \w\f3Privileges Granted\fP
1355.if \n(84<\n(38 .nr 84 \n(38
1356.nr 38 \wAll privileges
1357.if \n(84<\n(38 .nr 84 \n(38
1358.nr 38 \wAll privileges (1)
1359.if \n(84<\n(38 .nr 84 \n(38
1360.nr 38 \wAll privileges (1)
1361.if \n(84<\n(38 .nr 84 \n(38
1362.84
1363.rm 84
1364.nr 38 \n(c-
1365.if \n(84<\n(38 .nr 84 \n(38
1366.nr 38 \n(d-
1367.if \n(84<\n(38 .nr 84 \n(38
1368.nr 38 \n(e-
1369.if \n(84<\n(38 .nr 84 \n(38
1370.nr 38 \n(f-
1371.if \n(84<\n(38 .nr 84 \n(38
1372.nr 38 \n(g-
1373.if \n(84<\n(38 .nr 84 \n(38
1374.nr 38 \n(h-
1375.if \n(84<\n(38 .nr 84 \n(38
1376.nr 38 \n(i-
1377.if \n(84<\n(38 .nr 84 \n(38
1378.35
1379.nf
1380.ll \n(34u
1381.nr 38 1n
1382.nr 79 0
1383.nr 40 \n(79+(0*\n(38)
1384.nr 80 +\n(40
1385.nr 41 \n(80+(3*\n(38)
1386.nr 81 +\n(41
1387.nr 42 \n(81+(3*\n(38)
1388.nr 82 +\n(42
1389.nr 43 \n(82+(3*\n(38)
1390.nr 83 +\n(43
1391.nr 44 \n(83+(3*\n(38)
1392.nr 84 +\n(44
1393.nr TW \n(84
tbell16c34dd2009-05-04 18:28:26 -07001394.if t .if \n(TW>\n(.li .tm Table at line 1129 file Input is too wide - \n(TW units
duke6e45e102007-12-01 00:00:00 +00001395.fc  
1396.nr #T 0-1
1397.nr #a 0-1
1398.eo
1399.de T#
1400.ds #d .d
1401.if \(ts\n(.z\(ts\(ts .ds #d nl
1402.mk ##
1403.nr ## -1v
1404.ls 1
1405.ls
1406..
1407.ec
1408.ne \n(a|u+\n(.Vu
1409.ne \n(b|u+\n(.Vu
1410.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
1411.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
1412.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1413.nr 31 \n(.f
1414.nr 35 1m
1415\&\h'|\n(40u'\f3JAR File Type\fP\h'|\n(41u'\f3Identity in 1.1 database\fP\h'|\n(42u'\h'|\n(43u'\h'|\n(44u'\f3Privileges Granted\fP
1416.mk ##
1417.nr 31 \n(##
1418.sp |\n(##u-1v
1419.nr 37 \n(42u
1420.in +\n(37u
1421.a+
1422.in -\n(37u
1423.mk 32
1424.if \n(32>\n(31 .nr 31 \n(32
1425.sp |\n(##u-1v
1426.nr 37 \n(43u
1427.in +\n(37u
1428.b+
1429.in -\n(37u
1430.mk 32
1431.if \n(32>\n(31 .nr 31 \n(32
1432.sp |\n(31u
1433.ne \n(c|u+\n(.Vu
1434.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
1435.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1436.nr 31 \n(.f
1437.nr 35 1m
1438\&\h'|\n(40u'Signed JAR\h'|\n(41u'NO\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'
1439.mk ##
1440.nr 31 \n(##
1441.sp |\n(##u-1v
1442.nr 37 \n(44u
1443.in +\n(37u
1444.c+
1445.in -\n(37u
1446.mk 32
1447.if \n(32>\n(31 .nr 31 \n(32
1448.sp |\n(31u
1449.ne \n(d|u+\n(.Vu
1450.if (\n(d|+\n(#^-1v)>\n(#- .nr #- +(\n(d|+\n(#^-\n(#--1v)
1451.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1452.nr 31 \n(.f
1453.nr 35 1m
1454\&\h'|\n(40u'Unsigned JAR\h'|\n(41u'NO\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'
1455.mk ##
1456.nr 31 \n(##
1457.sp |\n(##u-1v
1458.nr 37 \n(44u
1459.in +\n(37u
1460.d+
1461.in -\n(37u
1462.mk 32
1463.if \n(32>\n(31 .nr 31 \n(32
1464.sp |\n(31u
1465.ne \n(e|u+\n(.Vu
1466.if (\n(e|+\n(#^-1v)>\n(#- .nr #- +(\n(e|+\n(#^-\n(#--1v)
1467.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1468.nr 31 \n(.f
1469.nr 35 1m
1470\&\h'|\n(40u'Signed JAR\h'|\n(41u'NO\h'|\n(42u'YES\h'|\n(43u'NO\h'|\n(44u'
1471.mk ##
1472.nr 31 \n(##
1473.sp |\n(##u-1v
1474.nr 37 \n(44u
1475.in +\n(37u
1476.e+
1477.in -\n(37u
1478.mk 32
1479.if \n(32>\n(31 .nr 31 \n(32
1480.sp |\n(31u
1481.ne \n(f|u+\n(.Vu
1482.if (\n(f|+\n(#^-1v)>\n(#- .nr #- +(\n(f|+\n(#^-\n(#--1v)
1483.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1484.nr 31 \n(.f
1485.nr 35 1m
1486\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Untrusted\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'
1487.mk ##
1488.nr 31 \n(##
1489.sp |\n(##u-1v
1490.nr 37 \n(44u
1491.in +\n(37u
1492.f+
1493.in -\n(37u
1494.mk 32
1495.if \n(32>\n(31 .nr 31 \n(32
1496.sp |\n(31u
1497.ne \n(g|u+\n(.Vu
1498.if (\n(g|+\n(#^-1v)>\n(#- .nr #- +(\n(g|+\n(#^-\n(#--1v)
1499.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1500.nr 31 \n(.f
1501.nr 35 1m
1502\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Untrusted\h'|\n(42u'NO\h'|\n(43u'YES\h'|\n(44u'
1503.mk ##
1504.nr 31 \n(##
1505.sp |\n(##u-1v
1506.nr 37 \n(44u
1507.in +\n(37u
1508.g+
1509.in -\n(37u
1510.mk 32
1511.if \n(32>\n(31 .nr 31 \n(32
1512.sp |\n(31u
1513.ne \n(h|u+\n(.Vu
1514.if (\n(h|+\n(#^-1v)>\n(#- .nr #- +(\n(h|+\n(#^-\n(#--1v)
1515.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1516.nr 31 \n(.f
1517.nr 35 1m
1518\&\h'|\n(40u'Signed JAR\h'|\n(41u'NO\h'|\n(42u'YES\h'|\n(43u'YES\h'|\n(44u'
1519.mk ##
1520.nr 31 \n(##
1521.sp |\n(##u-1v
1522.nr 37 \n(44u
1523.in +\n(37u
1524.h+
1525.in -\n(37u
1526.mk 32
1527.if \n(32>\n(31 .nr 31 \n(32
1528.sp |\n(31u
1529.ne \n(i|u+\n(.Vu
1530.if (\n(i|+\n(#^-1v)>\n(#- .nr #- +(\n(i|+\n(#^-\n(#--1v)
1531.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1532.nr 31 \n(.f
1533.nr 35 1m
1534\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'YES\h'|\n(43u'YES\h'|\n(44u'
1535.mk ##
1536.nr 31 \n(##
1537.sp |\n(##u-1v
1538.nr 37 \n(44u
1539.in +\n(37u
1540.i+
1541.in -\n(37u
1542.mk 32
1543.if \n(32>\n(31 .nr 31 \n(32
1544.sp |\n(31u
1545.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1546.nr 31 \n(.f
1547.nr 35 1m
1548\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'All privileges
1549.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1550.nr 31 \n(.f
1551.nr 35 1m
1552\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'YES\h'|\n(43u'NO\h'|\n(44u'All privileges (1)
1553.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1554.nr 31 \n(.f
1555.nr 35 1m
1556\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'NO\h'|\n(43u'YES\h'|\n(44u'All privileges (1)
1557.fc
1558.nr T. 1
1559.T# 1
1560.35
1561.rm a+
1562.rm b+
1563.rm c+
1564.rm d+
1565.rm e+
1566.rm f+
1567.rm g+
1568.rm h+
1569.rm i+
1570.TE
1571.if \n-(b.=0 .nr c. \n(.c-\n(d.-42
1572
1573.LP
1574.LP
1575Notes:
1576.LP
1577.RS 3
1578.TP 3
15791.
1580If an identity/alias is mentioned in the policy file, it must be imported into the keystore for the policy file to have any effect on privileges granted.
1581.TP 3
15822.
1583The policy file/keystore combination has precedence over a trusted identity in the identity database.
1584.TP 3
15853.
1586Untrusted identities are ignored in the Java 2 platform.
1587.TP 3
15884.
1589Only trusted identities can be imported into Java 2 SDK keystores.
1590.RE
1591
1592.LP
duke6e45e102007-12-01 00:00:00 +00001593.SH "SEE ALSO"
1594.LP
1595
1596.LP
1597.RS 3
1598.TP 2
1599o
tbell16c34dd2009-05-04 18:28:26 -07001600jar(1) tool documentation
duke6e45e102007-12-01 00:00:00 +00001601.TP 2
1602o
tbell16c34dd2009-05-04 18:28:26 -07001603keytool(1) tool documentation
duke6e45e102007-12-01 00:00:00 +00001604.TP 2
1605o
1606the
1607.na
1608\f4Security\fP @
1609.fi
tbell16c34dd2009-05-04 18:28:26 -07001610http://java.sun.com/docs/books/tutorial/security/index.html trail of the
duke6e45e102007-12-01 00:00:00 +00001611.na
1612\f4Java Tutorial\fP @
1613.fi
tbell16c34dd2009-05-04 18:28:26 -07001614http://java.sun.com/docs/books/tutorial/index.html for examples of the use of the \f3jarsigner\fP tool
duke6e45e102007-12-01 00:00:00 +00001615.RE
1616
1617.LP
1618
1619.LP
tbell16c34dd2009-05-04 18:28:26 -07001620.RE
duke6e45e102007-12-01 00:00:00 +00001621