Questions tagged [jarsigner]

jarsigner - JAR Signing and Verification Tool Generates signatures for Java ARchive (JAR) files, and verifies the signatures of signed JAR files.

The jarsigner tool is used for two purposes:

  1. to sign Java ARchive (JAR) files, and
  2. to verify the signatures and integrity of signed JAR files.

The 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 enables developers to produce JAR files. (Technically, any zip file can also be considered a JAR file, although when created by jar or processed by jarsigner, JAR files also contain a META-INF/MANIFEST.MF file.)

A digital signature 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:

Its authenticity can be verified, via a computation that uses the public key corresponding to the private key used to generate the signature. It cannot be forged, assuming the private key is kept secret. It is a function of the data signed and thus can't be claimed to be the signature for other data as well.

The signed data cannot be changed; if it is, the signature will no longer verify as being authentic.

In 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 certificate is a digitally signed statement from one entity, saying that the public key of some other entity has a particular value.

jarsigner uses key and certificate information from a keystore 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 utility is used to create and administer keystores.

jarsigner 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. jarsigner can verify the digital signature of the signed JAR file using the certificate inside it (in its signature block file).

Starting in J2SE 5.0, jarsigner 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 were added in J2SE 5.0 to allow applications to obtain the timestamp information.

At this time, jarsigner can only sign JAR files created by the SDK jar 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 jarsigner signs a zip file.)

The default jarsigner behavior is to sign a JAR (or zip) file. Use the -verify option to instead have it verify a signed JAR file.

Official source: http://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html

336 questions
8
votes
2 answers

Spring boot doesn't read Components after jar signing

I am developing a Spring Boot Application that serves REST HTTP(S) requests. (pretty common). It works as it is supposed, but after the final (and working) jar is signed (by a valid certificate) all URL mappings stop working, returning only 404 to…
Jairton Junior
  • 674
  • 6
  • 16
8
votes
1 answer

JarSigner - What does happen after expiration

If i create a keystore and sign a jar with this commands: keytool -genkey -alias myalias -keyalg RSA -validity 365 -keystore keys/my.keystore jarsigner -verbose -keystore keys/my.keystore -signedjar my_signed.jar my_unsigned.jar myalias Then i…
Che Veyo
  • 375
  • 3
  • 14
7
votes
3 answers

Jarsigner: "This jar contains entries whose certificate chain is not validated."

I get the following error on a self-signed jar: jar verified. Warning: This jar contains entries whose certificate chain is not validated. Re-run with the -verbose and -certs options for more details. I signed the jar like this: "C:\Program…
Joel
  • 3,427
  • 5
  • 38
  • 60
7
votes
3 answers

What is the cause for the failure: "jarsigner: attempt to rename {file} to {file}.org failed" when signing jars with ant?

I am getting the error: [signjar] jarsigner: attempt to rename C:\workspace\line_editor\lib\icon.jar to C:\workspace\line_editor\lib\icon.jar.orig failed when attempting to self sign a set of jars with ant inside Eclipse. The ant build…
jzd
  • 23,473
  • 9
  • 54
  • 76
7
votes
1 answer

How to renew a jar signature?

Warning: The signer certificate has expired. I get the following when I try to sign with jarsigner, and the output jar doesn't get generated. How do I renew my jar signature?
simpatico
  • 10,709
  • 20
  • 81
  • 126
7
votes
1 answer

How to configure TSA argument only on release in maven-jarsigner-plugin

Adding a timestamp to our jar's causes our maven build to take ~4 times longer than usual. Timestamp is necessary for release builds, but we don't need it for snapshot builds. How would we configure the POM file to only add the TSA arguments when it…
Mike B
  • 85
  • 2
  • 6
6
votes
4 answers

APK upload failed for Alpha version. Errors from apksigner: Digest algorithm and Signature Algorithm Which is not supported on API levels [[16, 17]]

I had signed the APK by using keytool, jarsigner, and zipalign utlities. I have used the following commands: keytool -genkey -v -keystore myAppTransporterKey.keystore -alias myTransporter -keyalg RSA -keysize 2048 -validity 10000 cordova plugin rm…
Abdul Rashid
  • 183
  • 1
  • 3
  • 11
6
votes
1 answer

What is the purpose of a signature file (*.SF) when signing a jar file?

As I learned from https://docs.oracle.com/javase/tutorial/deployment/jar/intro.html the procedure of signing jar file with jarsigner is following: The manifest file is updated with a list of hashes for each file: Name:…
kolobok
  • 3,835
  • 3
  • 38
  • 54
6
votes
2 answers

Jarsigner (MIME Content-Type is not application/timestamp-reply)

Some time ago I wrote a program to sign jars in our build process. Which worked for a couple of months without any problems. Now the jarsigner outputs (without changing anything!): jarsigner: unable to sign jar: java.io.IOException: MIME…
Lars
  • 1,750
  • 2
  • 17
  • 26
6
votes
4 answers

JDK 1.7 jarsigner with https tsa no longer works

It seems like Thawte root certificates in JDK 1.7.0_80 is revoked. https://www.thawte.com/roots/retired.html Using the 7u80 jarsigner no longer works and it worked fine just a few days ago. /usr/java/jdk1.7.0_80/jre/../bin/jarsigner -keystore…
DJViking
  • 832
  • 1
  • 12
  • 29
6
votes
4 answers

jarsigner Failed to execute goal

I am using maven-jarsigner-plugin in maven to sign multiple jars however it failes. Removing the jarsigner-maven-plugin from the pom.xml will cause the project to build successfully. So it is defenitly the jarsigner. Error: [ERROR] Failed to execute…
Staalk
  • 235
  • 1
  • 4
  • 12
6
votes
1 answer

Maven + jarsigner + test classes = error

I have a Maven project that includes some test cases. Today I tried adding the jarsigner plugin and now the tests fail with: java.lang.SecurityException: class "types.AccountType"'s signer information does not match signer information of other…
Ramon Casha
  • 101
  • 4
6
votes
3 answers

jarsigner manifest permissions

How can you add additional parameters to a jar's manifest file when signing it? I have a javaws app that uses some external libraries. Starting with java7u25 there is a need for additional parameters in the manifest (permissions and codebase). How…
6
votes
3 answers

How do I sign an apk with a private key I made with GPG?

Is this even possible? I have a key-pair that I already made with GPG but I just can't find a way to sign it with that key. I don't really want to make a new key with keytool or whatever just for this; I'd rather use the key I have now. Anybody know…
Junseok Lee
  • 705
  • 5
  • 18
5
votes
1 answer

jarsigner verification using only trusted certificates?

I noticed that in the keytool documentation it reads "jarsigner [...] checks whether or not the public key of that certificate is 'trusted', i.e., is contained in the specified keystore." whereas the jarsigner manpage states "A keystore is not…
Peter G.
  • 51
  • 3
1 2
3
22 23