jarsigner.1 revision 5116:d45bc4307996
1." Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
2." 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19." or visit www.oracle.com if you need additional information or have any
20." questions.
21."
22.TH jarsigner 1 "10 May 2011"
23
24.LP
25.SH "Name"
26jarsigner \- JAR Signing and Verification Tool
27.LP
28.LP
29Generates signatures for Java ARchive (JAR) files, and verifies the signatures of signed JAR files.
30.LP
31.SH "SYNOPSIS"
32.LP
33.nf
34\f3
35.fl
36\fP\f3jarsigner\fP [ options ] jar\-file alias
37.fl
38\f3jarsigner\fP \-verify [ options ] jar\-file [alias...]
39.fl
40.fi
41
42.LP
43.LP
44The 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.
45.LP
46.SH "DESCRIPTION"
47.LP
48.LP
49The \f3jarsigner\fP tool is used for two purposes:
50.LP
51.RS 3
52.TP 3
531.
54to sign Java ARchive (JAR) files, and
55.TP 3
562.
57to verify the signatures and integrity of signed JAR files.
58.RE
59
60.LP
61.LP
62The 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.)
63.LP
64.LP
65A \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:
66.LP
67.RS 3
68.TP 2
69o
70Its authenticity can be verified, via a computation that uses the public key corresponding to the private key used to generate the signature.
71.TP 2
72o
73It cannot be forged, assuming the private key is kept secret.
74.TP 2
75o
76It is a function of the data signed and thus can't be claimed to be the signature for other data as well.
77.TP 2
78o
79The signed data cannot be changed; if it is, the signature will no longer verify as being authentic.
80.RE
81
82.LP
83.LP
84In 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.
85.LP
86.LP
87\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.
88.LP
89.LP
90\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).
91.LP
92.LP
93\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.
94.LP
95.LP
96At 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.)
97.LP
98.LP
99The 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.
100.LP
101.SS
102Keystore Aliases
103.LP
104.LP
105All keystore entities are accessed via unique \f2aliases\fP.
106.LP
107.LP
108When 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.
109.LP
110.nf
111\f3
112.fl
113    jarsigner \-keystore /working/mystore \-storepass \fP\f4<keystore password>\fP\f3
114.fl
115      \-keypass \fP\f4<private key password>\fP\f3 MyJARFile.jar duke
116.fl
117\fP
118.fi
119
120.LP
121.LP
122Keystores are protected with a password, so the store password 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 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.
123.LP
124.SS
125Keystore Location
126.LP
127.LP
128\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.
129.LP
130.LP
131Note 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.
132.LP
133.SS
134Keystore Implementation
135.LP
136.LP
137The \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.
138.LP
139.LP
140Currently, 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.
141.LP
142.LP
143There 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.
144.LP
145.LP
146Keystore 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
147.na
148\f2How to Implement a Provider for the Java Cryptography Architecture\fP @
149.fi
150http://download.oracle.com/javase/7/docs/technotes/guides/security/crypto/HowToImplAProvider.html.
151.LP
152.LP
153Applications 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.
154.LP
155.LP
156\f3keytool\fP works on any file\-based keystore implementation. (It treats the keystore 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.
157.LP
158.LP
159For \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.
160.LP
161.LP
162If 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).
163.LP
164.LP
165Each 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.
166.LP
167.LP
168The \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):
169.LP
170.nf
171\f3
172.fl
173    KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
174.fl
175\fP
176.fi
177
178.LP
179.LP
180The 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:
181.LP
182.nf
183\f3
184.fl
185    keystore.type=jks
186.fl
187\fP
188.fi
189
190.LP
191.LP
192Note: Case doesn't matter in keystore type designations. For example, "JKS" would be considered the same as "jks".
193.LP
194.LP
195To 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
196.LP
197.nf
198\f3
199.fl
200    keystore.type=pkcs12
201.fl
202\fP
203.fi
204
205.LP
206.LP
207Note that if you us the PKCS#11 provider package, you should refer to the
208.na
209\f2KeyTool and JarSigner\fP @
210.fi
211http://download.oracle.com/javase/7/docs/technotes/guides/security/p11guide.html#KeyToolJarSigner section of the Java PKCS#11 Reference Guide for details.
212.LP
213.SS
214Supported Algorithms
215.LP
216.LP
217By default, \f3jarsigner\fP signs a JAR file using one of the following:
218.LP
219.RS 3
220.TP 2
221o
222DSA (Digital Signature Algorithm) with the SHA1 digest algorithm
223.TP 2
224o
225RSA algorithm with the SHA256 digest algorithm.
226.TP 2
227o
228EC (Elliptic Curve) cryptography algorithm with the SHA256 with ECDSA (Elliptic Curve Digital Signature Algorithm).
229.RE
230
231.LP
232.LP
233That 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 "SHA256withRSA" algorithm. If the signer's keys are EC keys, \f3jarsigner\fP will sign the JAR file using the "SHA256withECDSA" algorithm.
234.LP
235.LP
236These default signature algorithms can be overridden using the \f2\-sigalg\fP option.
237.LP
238.SS
239The Signed JAR File
240.LP
241.LP
242When \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:
243.LP
244.RS 3
245.TP 2
246o
247a signature file, with a .SF extension, and
248.TP 2
249o
250a signature block file, with a .DSA, .RSA, or .EC extension.
251.RE
252
253.LP
254.LP
255The base file names for these two files come from the value of the \f2\-sigFile\fP option. For example, if the option appears as
256.LP
257.nf
258\f3
259.fl
260\-sigFile MKSIGN
261.fl
262\fP
263.fi
264
265.LP
266.LP
267The files are named "MKSIGN.SF" and "MKSIGN.DSA".
268.LP
269.LP
270If 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.
271.LP
272\f3The Signature (.SF) File\fP
273.LP
274.LP
275A 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:
276.LP
277.RS 3
278.TP 2
279o
280the file name,
281.TP 2
282o
283the name of the digest algorithm used (SHA), and
284.TP 2
285o
286a SHA digest value.
287.RE
288
289.LP
290.LP
291In 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.
292.LP
293.LP
294The 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.
295.LP
296\f3The Signature Block File\fP
297.LP
298The .SF file is signed and the signature is placed in the signature block file. This 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. The file has the extension .DSA, .RSA, or .EC depending on the digest algorithm used.
299.SS
300Signature Timestamp
301.LP
302.LP
303\f2jarsigner\fP tool can 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:
304.LP
305.RS 3
306.TP 2
307o
308\f2\-tsa url\fP
309.TP 2
310o
311\f2\-tsacert alias\fP
312.TP 2
313o
314\f2\-altsigner class\fP
315.TP 2
316o
317\f2\-altsignerpath classpathlist\fP
318.RE
319
320.LP
321.LP
322Each of these options is detailed in the Options section below.
323.LP
324.SS
325JAR File Verification
326.LP
327.LP
328A 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:
329.LP
330.RS 3
331.TP 3
3321.
333Verify the signature of the .SF file itself.
334.br
335.br
336That 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.
337.TP 3
3382.
339Verify the digest listed in each entry in the .SF file with each corresponding section in the manifest.
340.br
341.br
342The .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.
343.br
344.br
345If 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).
346.br
347.br
348One 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.
349.TP 3
3503.
351Read 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.
352.RE
353
354.LP
355.LP
356If 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.
357.LP
358.SS
359Multiple Signatures for a JAR File
360.LP
361.LP
362A 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:
363.LP
364.nf
365\f3
366.fl
367  jarsigner myBundle.jar susan
368.fl
369  jarsigner myBundle.jar kevin
370.fl
371\fP
372.fi
373
374.LP
375.LP
376When 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:
377.LP
378.nf
379\f3
380.fl
381  SUSAN.SF
382.fl
383  SUSAN.DSA
384.fl
385  KEVIN.SF
386.fl
387  KEVIN.DSA
388.fl
389\fP
390.fi
391
392.LP
393.LP
394Note: 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.
395.LP
396.SH "OPTIONS"
397.LP
398.LP
399The various \f3jarsigner\fP options are listed and described below. Note:
400.LP
401.RS 3
402.TP 2
403o
404All option names are preceded by a minus sign (\-).
405.TP 2
406o
407The options may be provided in any order.
408.TP 2
409o
410Items in italics (option values) represent the actual values that must be supplied.
411.TP 2
412o
413The \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.
414.RE
415
416.LP
417.RS 3
418.TP 3
419\-keystore url
420Specifies 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.
421.br
422.br
423A 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).
424.br
425.br
426A 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.
427.br
428.br
429Note: 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,
430.nf
431\f3
432.fl
433  \-keystore \fP\f4filePathAndName\fP\f3
434.fl
435\fP
436.fi
437is treated as equivalent to
438.nf
439\f3
440.fl
441  \-keystore file:\fP\f4filePathAndName\fP\f3
442.fl
443\fP
444.fi
445If 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:
446.RS 3
447.TP 2
448o
449\f2\-keystore NONE\fP
450.TP 2
451o
452\f2\-storetype PKCS11\fP
453.RE
454For example, this command lists the contents of the configured PKCS#11 token:
455.nf
456\f3
457.fl
458   jarsigner \-keystore NONE \-storetype PKCS11 \-list
459.fl
460\fP
461.fi
462.TP 3
463\-storetype storetype
464Specifies 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.
465.br
466.br
467The 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.
468.TP 3
469\-storepass[:env | :file] argument
470Specifies 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.
471.br
472.br
473If the modifier \f2env\fP or \f2file\fP is not specified, then the password has the value \f2argument\fP. Otherwise, the password is retrieved as follows:
474.RS 3
475.TP 2
476o
477\f2env\fP: Retrieve the password from the environment variable named \f2argument\fP
478.TP 2
479o
480\f2file\fP: Retrieve the password from the file named \f2argument\fP
481.RE
482Note: 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.
483.TP 3
484\-keypass[:env | :file] argument
485Specifies 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.
486.br
487.br
488If the modifier \f2env\fP or \f2file\fP is not specified, then the password has the value \f2argument\fP. Otherwise, the password is retrieved as follows:
489.RS 3
490.TP 2
491o
492\f2env\fP: Retrieve the password from the environment variable named \f2argument\fP
493.TP 2
494o
495\f2file\fP: Retrieve the password from the file named \f2argument\fP
496.RE
497Note: 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.
498.TP 3
499\-sigfile file
500Specifies 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.
501.br
502.br
503The 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.
504.br
505.br
506If 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.
507.TP 3
508\-sigalg algorithm
509Specifies the name of the signature algorithm to use to sign the JAR file.
510.br
511.br
512See
513.na
514\f2Appendix A\fP @
515.fi
516http://download.oracle.com/javase/7/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, SHA256withRSA, or SHA256withECDSA 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.
517.TP 3
518\-digestalg algorithm
519Specifies the name of the message digest algorithm to use when digesting the entries of a jar file.
520.br
521.br
522See
523.na
524\f2Appendix A\fP @
525.fi
526http://download.oracle.com/javase/7/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, SHA256 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.
527.TP 3
528\-signedjar file
529Specifies the name to be used for the signed JAR file.
530.br
531.br
532If 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.
533.TP 3
534\-verify
535If 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)"
536.br
537.br
538It is possible to verify JAR files signed using either \f3jarsigner\fP or the JDK 1.1 \f3javakey\fP tool, or both.
539.br
540.br
541For further information on verification, see JAR File Verification.
542.TP 3
543\-certs
544If 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
545.RS 3
546.TP 2
547o
548the name of the type of certificate (stored in the .DSA file) that certifies the signer's public key
549.TP 2
550o
551if the certificate is an X.509 certificate (more specifically, an instance of \f2java.security.cert.X509Certificate\fP): the distinguished name of the signer
552.RE
553The 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:
554.RS 3
555.TP 2
556o
557in 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.
558.RE
559.TP 3
560\-certchain file
561Specifies 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.
562.TP 3
563\-verbose
564If 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.
565.TP 3
566\-internalsf
567In 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
568.TP 3
569\-sectionsonly
570If 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 .
571.br
572.br
573By 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.
574.br
575.br
576For further information, see JAR File Verification.
577.br
578.br
579\f3This option is mainly useful for testing; in practice, it should not be used, since doing so eliminates a useful optimization.\fP
580.TP 3
581\-protected
582Either \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.
583.TP 3
584\-providerClass provider\-class\-name
585Used 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.
586.br
587.br
588Used 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.
589.nf
590\f3
591.fl
592jarsigner \-keystore NONE \-storetype PKCS11 \\
593.fl
594          \-providerClass sun.security.pkcs11.SunPKCS11 \\
595.fl
596          \-providerArg /foo/bar/token.config \\
597.fl
598          \-list
599.fl
600\fP
601.fi
602.TP 3
603\-providerName providerName
604If 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.
605.br
606.br
607For 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
608.na
609\f2configuration attributes table\fP @
610.fi
611http://download.oracle.com/javase/7/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:
612.nf
613\f3
614.fl
615jarsigner \-keystore NONE \-storetype PKCS11 \\
616.fl
617        \-providerName SunPKCS11\-SmartCard \\
618.fl
619        \-list
620.fl
621\fP
622.fi
623.TP 3
624\-Jjavaoption
625Passes 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.
626.TP 3
627\-tsa url
628If \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.
629.br
630.br
631To generate the timestamp, \f2jarsigner\fP communicates with the TSA using the Time\-Stamp Protocol (TSP) defined in
632.na
633\f2RFC 3161\fP @
634.fi
635http://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.
636.TP 3
637\-tsacert alias
638If \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.
639.br
640.br
641The TSA's public key certificate must be present in the keystore when using \f2\-tsacert\fP.
642.TP 3
643\-altsigner class
644Specifies 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.
645.br
646.br
647For 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
648.TP 3
649\-altsignerpath classpathlist
650Specifies 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.
651.br
652.br
653An 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.
654.br
655.br
656Example of specifying the path to a jar file that contains the class file:
657.nf
658\f3
659.fl
660\-altsignerpath /home/user/lib/authsigner.jar
661.fl
662\fP
663.fi
664Note that the JAR file name is included.
665.br
666.br
667Example of specifying the path to the jar file that contains the class file:
668.nf
669\f3
670.fl
671\-altsignerpath /home/user/classes/com/sun/tools/jarsigner/
672.fl
673\fP
674.fi
675Note that the JAR file name is omitted.
676.TP 3
677\-strict
678During 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.
679.TP 3
680\-verbose:sub\-options
681For 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.
682.RE
683
684.LP
685.SH "EXAMPLES"
686.LP
687.SS
688Signing a JAR File
689.LP
690.LP
691Suppose 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. You can use the following to sign the JAR file and name the signed JAR file "sbundle.jar":
692.LP
693.nf
694\f3
695.fl
696    jarsigner \-keystore /working/mystore \-storepass \fP\f4<keystore password>\fP\f3
697.fl
698      \-keypass \fP\f4<private key password>\fP\f3 \-signedjar sbundle.jar bundle.jar jane
699.fl
700\fP
701.fi
702
703.LP
704.LP
705Note 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.
706.LP
707.LP
708If you want to be prompted for the store password and the private key password, you could shorten the above command to
709.LP
710.nf
711\f3
712.fl
713    jarsigner \-keystore /working/mystore
714.fl
715      \-signedjar sbundle.jar bundle.jar jane
716.fl
717\fP
718.fi
719
720.LP
721.LP
722If 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:
723.LP
724.nf
725\f3
726.fl
727    jarsigner \-signedjar sbundle.jar bundle.jar jane
728.fl
729\fP
730.fi
731
732.LP
733.LP
734Finally, 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:
735.LP
736.nf
737\f3
738.fl
739    jarsigner bundle.jar jane
740.fl
741\fP
742.fi
743
744.LP
745.SS
746Verifying a Signed JAR File
747.LP
748.LP
749To 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:
750.LP
751.nf
752\f3
753.fl
754    jarsigner \-verify sbundle.jar
755.fl
756\fP
757.fi
758
759.LP
760.LP
761If the verification is successful,
762.LP
763.nf
764\f3
765.fl
766    jar verified.
767.fl
768\fP
769.fi
770
771.LP
772.LP
773is displayed. Otherwise, an error message appears.
774.LP
775.LP
776You 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:
777.LP
778.nf
779\f3
780.fl
781    jarsigner \-verify \-verbose sbundle.jar
782.fl
783
784.fl
785           198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
786.fl
787           199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
788.fl
789          1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
790.fl
791    smk   2752 Fri Sep 26 16:12:30 PDT 1997 AclEx.class
792.fl
793    smk    849 Fri Sep 26 16:12:46 PDT 1997 test.class
794.fl
795
796.fl
797      s = signature was verified
798.fl
799      m = entry is listed in manifest
800.fl
801      k = at least one certificate was found in keystore
802.fl
803
804.fl
805    jar verified.
806.fl
807\fP
808.fi
809
810.LP
811.SS
812Verification with Certificate Information
813.LP
814.LP
815If 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 (if and only if 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,
816.LP
817.nf
818\f3
819.fl
820    jarsigner \-keystore /working/mystore \-verify \-verbose \-certs myTest.jar
821.fl
822
823.fl
824           198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
825.fl
826           199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
827.fl
828          1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
829.fl
830           208 Fri Sep 26 16:23:30 PDT 1997 META\-INF/JAVATEST.SF
831.fl
832          1087 Fri Sep 26 16:23:30 PDT 1997 META\-INF/JAVATEST.DSA
833.fl
834    smk   2752 Fri Sep 26 16:12:30 PDT 1997 Tst.class
835.fl
836
837.fl
838      X.509, CN=Test Group, OU=Java Software, O=Sun Microsystems, L=CUP, S=CA, C=US (javatest)
839.fl
840      X.509, CN=Jane Smith, OU=Java Software, O=Sun, L=cup, S=ca, C=us (jane)
841.fl
842
843.fl
844      s = signature was verified
845.fl
846      m = entry is listed in manifest
847.fl
848      k = at least one certificate was found in keystore
849.fl
850
851.fl
852    jar verified.
853.fl
854\fP
855.fi
856
857.LP
858.LP
859If 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
860.LP
861.nf
862\f3
863.fl
864      PGP, (bob)
865.fl
866\fP
867.fi
868
869.LP
870.SS
871Verification of a JAR File that Includes Identity Database Signers
872.LP
873.LP
874If 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.
875.LP
876.LP
877When 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:
878.LP
879.nf
880\f3
881.fl
882    jarsigner \-keystore /working/mystore \-verify \-verbose \-certs writeFile.jar
883.fl
884
885.fl
886           198 Fri Sep 26 16:14:06 PDT 1997 META\-INF/MANIFEST.MF
887.fl
888           199 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.SF
889.fl
890          1013 Fri Sep 26 16:22:10 PDT 1997 META\-INF/JANE.DSA
891.fl
892           199 Fri Sep 27 12:22:30 PDT 1997 META\-INF/DUKE.SF
893.fl
894          1013 Fri Sep 27 12:22:30 PDT 1997 META\-INF/DUKE.DSA
895.fl
896   smki   2752 Fri Sep 26 16:12:30 PDT 1997 writeFile.html
897.fl
898
899.fl
900      X.509, CN=Jane Smith, OU=Java Software, O=Sun, L=cup, S=ca, C=us (jane)
901.fl
902      X.509, CN=Duke, OU=Java Software, O=Sun, L=cup, S=ca, C=us [duke]
903.fl
904
905.fl
906      s = signature was verified
907.fl
908      m = entry is listed in manifest
909.fl
910      k = at least one certificate was found in keystore
911.fl
912      i = at least one certificate was found in identity scope
913.fl
914
915.fl
916    jar verified.
917.fl
918\fP
919.fi
920
921.LP
922.LP
923Note that the alias "duke" is in brackets to denote that it is an identity database alias, not a keystore alias.
924.LP
925.SH "WARNINGS"
926.LP
927During the signing/verifying process, jarsigner may display various warnings. These warning codes are defined as follows:
928.nf
929\f3
930.fl
931         hasExpiringCert         2
932.fl
933             This jar contains entries whose signer certificate will expire within six months
934.fl
935
936.fl
937         hasExpiredCert          4
938.fl
939             This jar contains entries whose signer certificate has expired.
940.fl
941
942.fl
943         notYetValidCert         4
944.fl
945             This jar contains entries whose signer certificate is not yet valid.
946.fl
947
948.fl
949         chainNotValidated       4
950.fl
951             This jar contains entries whose certificate chain cannot be correctly validated.
952.fl
953
954.fl
955         badKeyUsage             8
956.fl
957             This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing.
958.fl
959
960.fl
961         badExtendedKeyUsage     8
962.fl
963             This jar contains entries whose signer certificate's ExtendedKeyUsage extension
964.fl
965             doesn't allow code signing.
966.fl
967
968.fl
969         badNetscapeCertType     8
970.fl
971             This jar contains entries whose signer certificate's NetscapeCertType extension
972.fl
973             doesn't allow code signing.
974.fl
975
976.fl
977         hasUnsignedEntry        16
978.fl
979             This jar contains unsigned entries which have not been integrity\-checked.
980.fl
981
982.fl
983         notSignedByAlias        32
984.fl
985             This jar contains signed entries which are not signed by the specified alias(es)
986.fl
987
988.fl
989         aliasNotInStore         32
990.fl
991             This jar contains signed entries that are not signed by alias in this keystore
992.fl
993
994.fl
995\fP
996.fi
997
998.LP
999.LP
1000When 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.
1001.LP
1002.LP
1003\f3Note\fP: Exit codes are reused because only 0\-255 is legal for Unix. In any case, if the signing/verifying process fails, the following exit code will be returned:
1004.LP
1005.nf
1006\f3
1007.fl
1008failure                 1
1009.fl
1010\fP
1011.fi
1012
1013.LP
1014.SS
1015Compatibility with JDK 1.1
1016.LP
1017.LP
1018The \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.
1019.LP
1020.LP
1021The 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,
1022.LP
1023.RS 3
1024.TP 2
1025o
1026It is possible to import the information from an identity database into a keystore, via the \f3keytool\fP \f2\-identitydb\fP command.
1027.TP 2
1028o
1029\f3jarsigner\fP can sign JAR files also previously signed using \f3javakey\fP.
1030.TP 2
1031o
1032\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.
1033.RE
1034
1035.LP
1036.LP
1037The following table explains how JAR files that were signed in JDK 1.1.x are treated in the Java 2 platform.
1038.LP
1039.LP
1040.if \n+(b.=1 .nr d. \n(.c-\n(c.-1
1041.de 35
1042.ps \n(.s
1043.vs \n(.vu
1044.in \n(.iu
1045.if \n(.u .fi
1046.if \n(.j .ad
1047.if \n(.j=0 .na
1048..
1049.nf
1050.nr #~ 0
1051.if n .nr #~ 0.6n
1052.ds #d .d
1053.if \(ts\n(.z\(ts\(ts .ds #d nl
1054.fc
1055.nr 33 \n(.s
1056.rm 80 81 82 83 84
1057.nr 34 \n(.lu
1058.eo
1059.am 82
1060.br
1061.di a+
1062.35
1063.ft \n(.f
1064.ll \n(34u*1u/6u
1065.if \n(.l<\n(82 .ll \n(82u
1066.in 0
1067\f3Trusted Identity imported into Java 2 Platform keystore from 1.1 database (4)\fP
1068.br
1069.di
1070.nr a| \n(dn
1071.nr a- \n(dl
1072..
1073.ec \
1074.eo
1075.am 83
1076.br
1077.di b+
1078.35
1079.ft \n(.f
1080.ll \n(34u*1u/6u
1081.if \n(.l<\n(83 .ll \n(83u
1082.in 0
1083\f3Policy File grants privileges to Identity/Alias\fP
1084.br
1085.di
1086.nr b| \n(dn
1087.nr b- \n(dl
1088..
1089.ec \
1090.eo
1091.am 84
1092.br
1093.di c+
1094.35
1095.ft \n(.f
1096.ll \n(34u*1u/6u
1097.if \n(.l<\n(84 .ll \n(84u
1098.in 0
1099Default privileges granted to all code.
1100.br
1101.di
1102.nr c| \n(dn
1103.nr c- \n(dl
1104..
1105.ec \
1106.eo
1107.am 84
1108.br
1109.di d+
1110.35
1111.ft \n(.f
1112.ll \n(34u*1u/6u
1113.if \n(.l<\n(84 .ll \n(84u
1114.in 0
1115Default privileges granted to all code.
1116.br
1117.di
1118.nr d| \n(dn
1119.nr d- \n(dl
1120..
1121.ec \
1122.eo
1123.am 84
1124.br
1125.di e+
1126.35
1127.ft \n(.f
1128.ll \n(34u*1u/6u
1129.if \n(.l<\n(84 .ll \n(84u
1130.in 0
1131Default privileges granted to all code.
1132.br
1133.di
1134.nr e| \n(dn
1135.nr e- \n(dl
1136..
1137.ec \
1138.eo
1139.am 84
1140.br
1141.di f+
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. (3)
1148.br
1149.di
1150.nr f| \n(dn
1151.nr f- \n(dl
1152..
1153.ec \
1154.eo
1155.am 84
1156.br
1157.di g+
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. (1,3)
1164.br
1165.di
1166.nr g| \n(dn
1167.nr g- \n(dl
1168..
1169.ec \
1170.eo
1171.am 84
1172.br
1173.di h+
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 plus privileges granted in policy file.
1180.br
1181.di
1182.nr h| \n(dn
1183.nr h- \n(dl
1184..
1185.ec \
1186.eo
1187.am 84
1188.br
1189.di i+
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 plus privileges granted in policy file. (2)
1196.br
1197.di
1198.nr i| \n(dn
1199.nr i- \n(dl
1200..
1201.ec \
1202.35
1203.nf
1204.ll \n(34u
1205.nr 80 0
1206.nr 38 \w\f3JAR File Type\fP
1207.if \n(80<\n(38 .nr 80 \n(38
1208.nr 38 \wSigned JAR
1209.if \n(80<\n(38 .nr 80 \n(38
1210.nr 38 \wUnsigned JAR
1211.if \n(80<\n(38 .nr 80 \n(38
1212.nr 38 \wSigned JAR
1213.if \n(80<\n(38 .nr 80 \n(38
1214.nr 38 \wSigned JAR
1215.if \n(80<\n(38 .nr 80 \n(38
1216.nr 38 \wSigned JAR
1217.if \n(80<\n(38 .nr 80 \n(38
1218.nr 38 \wSigned JAR
1219.if \n(80<\n(38 .nr 80 \n(38
1220.nr 38 \wSigned JAR
1221.if \n(80<\n(38 .nr 80 \n(38
1222.nr 38 \wSigned JAR
1223.if \n(80<\n(38 .nr 80 \n(38
1224.nr 38 \wSigned JAR
1225.if \n(80<\n(38 .nr 80 \n(38
1226.nr 38 \wSigned JAR
1227.if \n(80<\n(38 .nr 80 \n(38
1228.80
1229.rm 80
1230.nr 81 0
1231.nr 38 \w\f3Identity in 1.1 database\fP
1232.if \n(81<\n(38 .nr 81 \n(38
1233.nr 38 \wNO
1234.if \n(81<\n(38 .nr 81 \n(38
1235.nr 38 \wNO
1236.if \n(81<\n(38 .nr 81 \n(38
1237.nr 38 \wNO
1238.if \n(81<\n(38 .nr 81 \n(38
1239.nr 38 \wYES/Untrusted
1240.if \n(81<\n(38 .nr 81 \n(38
1241.nr 38 \wYES/Untrusted
1242.if \n(81<\n(38 .nr 81 \n(38
1243.nr 38 \wNO
1244.if \n(81<\n(38 .nr 81 \n(38
1245.nr 38 \wYES/Trusted
1246.if \n(81<\n(38 .nr 81 \n(38
1247.nr 38 \wYES/Trusted
1248.if \n(81<\n(38 .nr 81 \n(38
1249.nr 38 \wYES/Trusted
1250.if \n(81<\n(38 .nr 81 \n(38
1251.nr 38 \wYES/Trusted
1252.if \n(81<\n(38 .nr 81 \n(38
1253.81
1254.rm 81
1255.nr 82 0
1256.nr 38 \wNO
1257.if \n(82<\n(38 .nr 82 \n(38
1258.nr 38 \wNO
1259.if \n(82<\n(38 .nr 82 \n(38
1260.nr 38 \wYES
1261.if \n(82<\n(38 .nr 82 \n(38
1262.nr 38 \wNO
1263.if \n(82<\n(38 .nr 82 \n(38
1264.nr 38 \wNO
1265.if \n(82<\n(38 .nr 82 \n(38
1266.nr 38 \wYES
1267.if \n(82<\n(38 .nr 82 \n(38
1268.nr 38 \wYES
1269.if \n(82<\n(38 .nr 82 \n(38
1270.nr 38 \wNO
1271.if \n(82<\n(38 .nr 82 \n(38
1272.nr 38 \wYES
1273.if \n(82<\n(38 .nr 82 \n(38
1274.nr 38 \wNO
1275.if \n(82<\n(38 .nr 82 \n(38
1276.82
1277.rm 82
1278.nr 38 \n(a-
1279.if \n(82<\n(38 .nr 82 \n(38
1280.nr 83 0
1281.nr 38 \wNO
1282.if \n(83<\n(38 .nr 83 \n(38
1283.nr 38 \wNO
1284.if \n(83<\n(38 .nr 83 \n(38
1285.nr 38 \wNO
1286.if \n(83<\n(38 .nr 83 \n(38
1287.nr 38 \wNO
1288.if \n(83<\n(38 .nr 83 \n(38
1289.nr 38 \wYES
1290.if \n(83<\n(38 .nr 83 \n(38
1291.nr 38 \wYES
1292.if \n(83<\n(38 .nr 83 \n(38
1293.nr 38 \wYES
1294.if \n(83<\n(38 .nr 83 \n(38
1295.nr 38 \wNO
1296.if \n(83<\n(38 .nr 83 \n(38
1297.nr 38 \wNO
1298.if \n(83<\n(38 .nr 83 \n(38
1299.nr 38 \wYES
1300.if \n(83<\n(38 .nr 83 \n(38
1301.83
1302.rm 83
1303.nr 38 \n(b-
1304.if \n(83<\n(38 .nr 83 \n(38
1305.nr 84 0
1306.nr 38 \w\f3Privileges Granted\fP
1307.if \n(84<\n(38 .nr 84 \n(38
1308.nr 38 \wAll privileges
1309.if \n(84<\n(38 .nr 84 \n(38
1310.nr 38 \wAll privileges (1)
1311.if \n(84<\n(38 .nr 84 \n(38
1312.nr 38 \wAll privileges (1)
1313.if \n(84<\n(38 .nr 84 \n(38
1314.84
1315.rm 84
1316.nr 38 \n(c-
1317.if \n(84<\n(38 .nr 84 \n(38
1318.nr 38 \n(d-
1319.if \n(84<\n(38 .nr 84 \n(38
1320.nr 38 \n(e-
1321.if \n(84<\n(38 .nr 84 \n(38
1322.nr 38 \n(f-
1323.if \n(84<\n(38 .nr 84 \n(38
1324.nr 38 \n(g-
1325.if \n(84<\n(38 .nr 84 \n(38
1326.nr 38 \n(h-
1327.if \n(84<\n(38 .nr 84 \n(38
1328.nr 38 \n(i-
1329.if \n(84<\n(38 .nr 84 \n(38
1330.35
1331.nf
1332.ll \n(34u
1333.nr 38 1n
1334.nr 79 0
1335.nr 40 \n(79+(0*\n(38)
1336.nr 80 +\n(40
1337.nr 41 \n(80+(3*\n(38)
1338.nr 81 +\n(41
1339.nr 42 \n(81+(3*\n(38)
1340.nr 82 +\n(42
1341.nr 43 \n(82+(3*\n(38)
1342.nr 83 +\n(43
1343.nr 44 \n(83+(3*\n(38)
1344.nr 84 +\n(44
1345.nr TW \n(84
1346.if t .if \n(TW>\n(.li .tm Table at line 1082 file Input is too wide - \n(TW units
1347.fc  
1348.nr #T 0-1
1349.nr #a 0-1
1350.eo
1351.de T#
1352.ds #d .d
1353.if \(ts\n(.z\(ts\(ts .ds #d nl
1354.mk ##
1355.nr ## -1v
1356.ls 1
1357.ls
1358..
1359.ec
1360.ne \n(a|u+\n(.Vu
1361.ne \n(b|u+\n(.Vu
1362.if (\n(a|+\n(#^-1v)>\n(#- .nr #- +(\n(a|+\n(#^-\n(#--1v)
1363.if (\n(b|+\n(#^-1v)>\n(#- .nr #- +(\n(b|+\n(#^-\n(#--1v)
1364.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1365.nr 31 \n(.f
1366.nr 35 1m
1367\&\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
1368.mk ##
1369.nr 31 \n(##
1370.sp |\n(##u-1v
1371.nr 37 \n(42u
1372.in +\n(37u
1373.a+
1374.in -\n(37u
1375.mk 32
1376.if \n(32>\n(31 .nr 31 \n(32
1377.sp |\n(##u-1v
1378.nr 37 \n(43u
1379.in +\n(37u
1380.b+
1381.in -\n(37u
1382.mk 32
1383.if \n(32>\n(31 .nr 31 \n(32
1384.sp |\n(31u
1385.ne \n(c|u+\n(.Vu
1386.if (\n(c|+\n(#^-1v)>\n(#- .nr #- +(\n(c|+\n(#^-\n(#--1v)
1387.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1388.nr 31 \n(.f
1389.nr 35 1m
1390\&\h'|\n(40u'Signed JAR\h'|\n(41u'NO\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'
1391.mk ##
1392.nr 31 \n(##
1393.sp |\n(##u-1v
1394.nr 37 \n(44u
1395.in +\n(37u
1396.c+
1397.in -\n(37u
1398.mk 32
1399.if \n(32>\n(31 .nr 31 \n(32
1400.sp |\n(31u
1401.ne \n(d|u+\n(.Vu
1402.if (\n(d|+\n(#^-1v)>\n(#- .nr #- +(\n(d|+\n(#^-\n(#--1v)
1403.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1404.nr 31 \n(.f
1405.nr 35 1m
1406\&\h'|\n(40u'Unsigned JAR\h'|\n(41u'NO\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'
1407.mk ##
1408.nr 31 \n(##
1409.sp |\n(##u-1v
1410.nr 37 \n(44u
1411.in +\n(37u
1412.d+
1413.in -\n(37u
1414.mk 32
1415.if \n(32>\n(31 .nr 31 \n(32
1416.sp |\n(31u
1417.ne \n(e|u+\n(.Vu
1418.if (\n(e|+\n(#^-1v)>\n(#- .nr #- +(\n(e|+\n(#^-\n(#--1v)
1419.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1420.nr 31 \n(.f
1421.nr 35 1m
1422\&\h'|\n(40u'Signed JAR\h'|\n(41u'NO\h'|\n(42u'YES\h'|\n(43u'NO\h'|\n(44u'
1423.mk ##
1424.nr 31 \n(##
1425.sp |\n(##u-1v
1426.nr 37 \n(44u
1427.in +\n(37u
1428.e+
1429.in -\n(37u
1430.mk 32
1431.if \n(32>\n(31 .nr 31 \n(32
1432.sp |\n(31u
1433.ne \n(f|u+\n(.Vu
1434.if (\n(f|+\n(#^-1v)>\n(#- .nr #- +(\n(f|+\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'YES/Untrusted\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.f+
1445.in -\n(37u
1446.mk 32
1447.if \n(32>\n(31 .nr 31 \n(32
1448.sp |\n(31u
1449.ne \n(g|u+\n(.Vu
1450.if (\n(g|+\n(#^-1v)>\n(#- .nr #- +(\n(g|+\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'Signed JAR\h'|\n(41u'YES/Untrusted\h'|\n(42u'NO\h'|\n(43u'YES\h'|\n(44u'
1455.mk ##
1456.nr 31 \n(##
1457.sp |\n(##u-1v
1458.nr 37 \n(44u
1459.in +\n(37u
1460.g+
1461.in -\n(37u
1462.mk 32
1463.if \n(32>\n(31 .nr 31 \n(32
1464.sp |\n(31u
1465.ne \n(h|u+\n(.Vu
1466.if (\n(h|+\n(#^-1v)>\n(#- .nr #- +(\n(h|+\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'YES\h'|\n(44u'
1471.mk ##
1472.nr 31 \n(##
1473.sp |\n(##u-1v
1474.nr 37 \n(44u
1475.in +\n(37u
1476.h+
1477.in -\n(37u
1478.mk 32
1479.if \n(32>\n(31 .nr 31 \n(32
1480.sp |\n(31u
1481.ne \n(i|u+\n(.Vu
1482.if (\n(i|+\n(#^-1v)>\n(#- .nr #- +(\n(i|+\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/Trusted\h'|\n(42u'YES\h'|\n(43u'YES\h'|\n(44u'
1487.mk ##
1488.nr 31 \n(##
1489.sp |\n(##u-1v
1490.nr 37 \n(44u
1491.in +\n(37u
1492.i+
1493.in -\n(37u
1494.mk 32
1495.if \n(32>\n(31 .nr 31 \n(32
1496.sp |\n(31u
1497.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1498.nr 31 \n(.f
1499.nr 35 1m
1500\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'NO\h'|\n(43u'NO\h'|\n(44u'All privileges
1501.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1502.nr 31 \n(.f
1503.nr 35 1m
1504\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'YES\h'|\n(43u'NO\h'|\n(44u'All privileges (1)
1505.ta \n(80u \n(81u \n(82u \n(83u \n(84u
1506.nr 31 \n(.f
1507.nr 35 1m
1508\&\h'|\n(40u'Signed JAR\h'|\n(41u'YES/Trusted\h'|\n(42u'NO\h'|\n(43u'YES\h'|\n(44u'All privileges (1)
1509.fc
1510.nr T. 1
1511.T# 1
1512.35
1513.rm a+
1514.rm b+
1515.rm c+
1516.rm d+
1517.rm e+
1518.rm f+
1519.rm g+
1520.rm h+
1521.rm i+
1522.if \n-(b.=0 .nr c. \n(.c-\n(d.-42
1523
1524.LP
1525.LP
1526Notes:
1527.LP
1528.RS 3
1529.TP 3
15301.
1531If 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.
1532.TP 3
15332.
1534The policy file/keystore combination has precedence over a trusted identity in the identity database.
1535.TP 3
15363.
1537Untrusted identities are ignored in the Java 2 platform.
1538.TP 3
15394.
1540Only trusted identities can be imported into Java 2 SDK keystores.
1541.RE
1542
1543.LP
1544.SH "SEE ALSO"
1545.LP
1546.RS 3
1547.TP 2
1548o
1549jar(1) tool documentation
1550.TP 2
1551o
1552keytool(1) tool documentation
1553.TP 2
1554o
1555the
1556.na
1557\f4Security\fP @
1558.fi
1559http://download.oracle.com/javase/tutorial/security/index.html trail of the
1560.na
1561\f4Java Tutorial\fP @
1562.fi
1563http://download.oracle.com/javase/tutorial/index.html for examples of the use of the \f3jarsigner\fP tool
1564.RE
1565
1566.LP
1567
1568