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
4
votes
2 answers

Speed up jarsigner with hardware token?

I formerly signed jar files using a locally installed keystore as part of an automated build. I'm now faced with having to use a hardware-based device, due to recent changes to minimal code signing requirements, and while I've figured out how to do…
Andy Lowry
  • 785
  • 7
  • 12
4
votes
1 answer

How to sign APK using keystore received from customer?

I received a keystore file from a customer which I am supposed to use to sign an APK that is going to replace/update an existing APK on the play store. Unfortunately I get the following error: jarsigner: Certificate chain not found for: alias_name.…
BastiBen
  • 19,679
  • 11
  • 56
  • 86
4
votes
1 answer

Java digital-signing related files (MANIFEST.MF, *.SF, *.DSA) and their content?

I am trying to understand what are the steps that jar and jarsigner go through when jarring up and signing up java code, to replicate parts of these steps programmatically. Explicitely I'd like to know what exactly goes into a .SF file, because I've…
Redoman
  • 3,059
  • 3
  • 34
  • 62
4
votes
0 answers

Maven-android-jarsigner failed to sign

I am trying to sign a core application and a tests application for that core app. I was getting the error: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:internal-integration-test…
4
votes
2 answers

Signed Java applet suddenly has mixed code warning

I have a signed applet on my website that had been working fine for nearly a year. Today, however, it's giving my users a mixed code warning. I found here that certain Apache components, which I happen to be using, can generate a mixed code warning.…
jay
  • 1,524
  • 4
  • 25
  • 45
4
votes
2 answers

how to sign ".apk" file on an Android Phone?

I want to generate an new ".apk" file on the phone (a function in my app-market like app), and I have to sign it before install it. I think I have to run the JarSigner on the phone. JarSigner is found in the following two project: OpenJDK and…
Yin
  • 612
  • 7
  • 10
4
votes
1 answer

Appearance of Java Security dialog

The Java Security dialog is shown when loading a signed applet. What does the Java Security dialog look like?
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
4
votes
2 answers

Jar file works great until it is signed (in Windows)

I'm going to start this out by saying I'm not a Java programmer, I'm a PHP programmer. I ran into a situation were websockets weren't going to cut it and I found this site that offered a solution: http://stephengware.com/proj/javasocketbridge/ It's…
Beachhouse
  • 4,972
  • 3
  • 25
  • 39
4
votes
2 answers

Maven jarsigner plugin does not work during release

I need to sign the released jars and I want to do it with the maven jarsigner plugin. So I added it like this: org.apache.maven.plugins maven-jarsigner-plugin
Tarlog
  • 10,024
  • 2
  • 43
  • 67
4
votes
1 answer

Eclipse Option not available : Android Tools > Export Unsigned Application Package

I have created my Google market publisher private keystore. Now I want to Export the UNSIGNED apk using eclipse but I am not able to find the option : Export Unsigned Application Package. All I can see is this option : Export Android Application,…
Vikas Singh
  • 1,781
  • 7
  • 27
  • 54
3
votes
0 answers

C/C++ code or Bash script to sign jar files

Is there C/C++ code or a Bash script that can sign Java .jar files without using a JVM? Such code might be useful for embedded applications that serve a jar file with a small HTTP server, or other situations where a jar file might need to be edited…
Eli Rosencruft
  • 7,232
  • 1
  • 19
  • 17
3
votes
3 answers

Using jarsigner -verify on an APK asks me to specify an alias?

I'm trying to check the signature information on an APK. The docs say to use jarsigner -verify -verbose -certs app.apk and various SO questions agree. But if I grab JDK 1.7 and do that, I get the error: Please specify alias name Which is hard to…
fenomas
  • 11,131
  • 2
  • 33
  • 57
3
votes
0 answers

com.sun.deploy.net.jarsigningexception could not verify signing in resource: xalan.jar, 2.7.1

Our JNLP client application contains different JAR's. We sign all these JAR's at build-process. Now, we have one Jar which can not be verified, but only under Windows! (xalan-2.7.1.jar) If we run the JNLP under windows, we get this…
Stefan
  • 31
  • 1
  • 3
3
votes
3 answers

jarsigner: unable to open jar file: app-release-unsigned.apk

I am currently working on cordova project and I tried to generate key with the set of lines keytool -genkey -v -keystore -alias -keyalg RSA -keysize 2048 -validity 10000 I also generated a keystore after that I used…
Javith J
  • 77
  • 2
  • 9
3
votes
1 answer

Jarsigner : sign standalone jar with Developer ID certificate

While I can use Developer ID certificates from Apple to sign .app and .dmg, I'm wondering if there is way to use it to sign the standalone jar version (click & run), and also a couple of eclipse plugins (jars). I sign the jars with Comodo Cert and…
josephino
  • 360
  • 4
  • 21