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
3
votes
1 answer

Keytool and jarsigner tool

I have developed a blackberry application which I have loaded in the BB device. But as we know, without signing the application with RIM we can't run the application on the device. Is there any way which I can create the trial version of my…
user469999
  • 2,101
  • 4
  • 24
  • 30
3
votes
2 answers

Using custom PKCS11 provider with jarsigner

I wrote a custom PKCS11 provider and now i want to user it via jarsigner. My command : jarsigner -verbose -keystore NONE -storetype PKCS11 -providerClass my.provider.class jar_to_sign_on.jar "key_name" And i get the following error : jarsigner…
Saar peer
  • 817
  • 6
  • 21
3
votes
0 answers

why does jar signature remain valid even if a file is removed?

When I remove a file from a signed jar file its signature still validates. Furthermore when I tamper with a file in the jar file although it cannot validate the signature it still runs via java -jar. Steps to reproduce: Download an example jar…
destan
  • 4,301
  • 3
  • 35
  • 62
3
votes
1 answer

Certificate chain not found, but keystore contains private key

Im trying to sign my apk so I can release an update to my app with this command: jarsigner ­-verbose -sigalg SHA1withRSA -­digestalg SHA1 ­-keystore my­release-key.keystore CordovaApp­release­unsigned.apk alias_name but getting this…
tobbe
  • 1,737
  • 6
  • 23
  • 40
3
votes
1 answer

Add Metadata to Android APK without Breaking Signature

Is there a way to add metadata to an Android APK without impacting the signature? Will adding files to the META-INF folder break the signature? What about modifying the file: MANIFAST.MF?
AnDev123
  • 509
  • 1
  • 8
  • 13
3
votes
1 answer

How do I re-sign a debug signed apk such that the mp3 files are not compressed?

I have some mp3 files in my res/raw/ folder when it first gets signed with android debug key the mp3 file bundled with the apk is not compressed. I verify this by typing unzip -lv and i get this 1670  Stored     1670   0%  06-23-14 18:48  3b4b6017…
Navin GV
  • 700
  • 3
  • 10
  • 24
3
votes
1 answer

Ant signjar task takes too long to timestamp

I am building a project using Hudson. I have few jar files which i want to sign with the timestamp using Ant SignJar task. It works like a charm when there is no timestamp - it takes about 2-3 seconds for one file. The problem appears when i add the…
skyline00
  • 119
  • 1
  • 6
3
votes
1 answer

Unknown publishers applet browser, Signing jar

i can't understand where problem lies to run applet in browser when deploy my project accordind…
Attif
  • 1,158
  • 13
  • 17
3
votes
1 answer

Java Keytool jdk/jre 64/32bit - Is there a difference?

I noticed, there are Java 4 different Keytool.exe(and jarsigner.exe) on my computer. For either Java 64bit or 32bit and either in the jdk and jre directory. Does it make any difference, which one I use to sign my jars?
Sip
  • 373
  • 1
  • 6
  • 22
3
votes
2 answers

How to use OpenSSL to validate a *.SF / *.RSA signature created by the Jarsigner

I have an archive I want to sign and I want to validate it in C with OpenSSL. To sign the archive the jarsigner seemed like a good idea, considering I wouldn't have to create something on my own, and it seems to work great. With OpenSSL I can…
Benjamin
  • 51
  • 6
3
votes
0 answers

INSTALL_PARSE_FAILED_NO_CERTIFICATES with JDK 1.7

I have manually signed APK using JDK 7. While installing I got the "INSTALL PARSE FAILED NO CERTIFICATES" error. I have referred some sites and got an idea to use different signing algorithm for JDK 7. jarsigner -verbose -sigalg MD5withRSA…
Ponmalar
  • 6,871
  • 10
  • 50
  • 80
3
votes
2 answers

How can I sign an OSGi bundle with Ant without overwriting the MANIFEST.MF contents?

I have an Eclipse plugin for which I create the OSGi bundle JARs with Ant. I would like to sign them with the Ant task, but that overwrites the MANIFEST.MF contents with the class signatures, making the OSGi bundles unusable. The JDK jarsigner tool…
FelixM
  • 1,496
  • 1
  • 9
  • 19
3
votes
3 answers

executing jarsigner command generates error: "Jarsigner is not recognized internal or external command"

I am trying to verify signature of apk uploaded on my site. I am trying to execute String command= "cmd /c jarsigner -verify -verbose -certs " +Filelocation; Process proc = Runtime.getRuntime().exec(command); BufferedReader reader=new…
user2381331
  • 31
  • 1
  • 1
  • 4
3
votes
2 answers

Java: Verify whether the jar is signed

I am working with Jarsigner. I want to check whether the given jar is signed or not. If user uploads a jar file, I want to find whether the jarfile is signed or not. I tried with the below code,…
Lolly
  • 34,250
  • 42
  • 115
  • 150
3
votes
2 answers

Maven release:perform doesn't recognize keystore parameters

I have generated my project using the android-release archetype. In its documentation is indicated to add the android-release profile inside the settings.xmlfile. My ~/.m2/settings.xml looks like this:
rciovati
  • 27,603
  • 6
  • 82
  • 101