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
1
vote
0 answers

Signed jar execution performance

When I execute a signed jar, it is very slow using 2GB of memory. The same jar not signed is very fast and uses 300MB of memory. Is there any way to reduce the amount of memory used in executing a signed jar. I used a plugin in the pom.xml to sign…
Anna
  • 11
  • 1
1
vote
1 answer

To change jar expiry time

I need to change expiry date of jar being signed by a certificate to say 30 days. Hence I execute in sequence (I provide relevant inputs for the first command). But in-spite of the -validity option being given as 30 days, the jarsigner command says…
anotherNovice1984
  • 397
  • 3
  • 6
  • 13
1
vote
1 answer

Allow a jar to run only if it is signed

I want to configure the jdk so that if I were to do java -jar myjar.jar then myjar would only execute if it has been signed (by a particular signer). I found this answer but I'm not sure editing policy files is the solution. From my understanding by…
jvs
  • 43
  • 1
  • 3
1
vote
1 answer

jarsigner returns NullPointerException error

I have a cordova app and am using cmd to build it and need to sign its release apk. First I did it without the -tsa option so on running the command it asked the pwd and then was signed with the warning : jarsigner -verbose -sigalg SHA1withRSA…
sqlchild
  • 8,754
  • 28
  • 105
  • 167
1
vote
0 answers

JDK Jarsigner : jar is unsigned. (signatures missing or not parsable)

I Signed with JDK:1.8 jarsigner. Verify Results with JDK:1.8: C:\glassfish4\jdk8\bin\jarsigner -verify sample_sha1_sha1.jar -verbose Timestamped by "***" on Wed Jun 06 17:59:57 UTC 2018 Timestamp digest algorithm: SHA-1 Timestamp…
Satscreate
  • 495
  • 12
  • 38
1
vote
1 answer

Maven jarsigner plugin configuration not working

I am trying to sign a jar file with the following pom.xml config. org.apache.maven.plugins maven-jarsigner-plugin
Igor
  • 323
  • 2
  • 13
1
vote
1 answer

using java - How to read code signing/cert information from jar

I'm looking for a way to read the code signing/certificate information form JAR files. Actually, I do want to know about the jar: Is it signed? Is the signature valid (changed after signing)? Was the TSA provided during signing? What…
PaulEdison
  • 897
  • 1
  • 15
  • 36
1
vote
0 answers

Jarsigner error: Invalid value for MonthOfYear

When trying to sign an unsigned release apk, I'm using the following command in terminal: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore My_Key_Sign.keystore app-myapp-release-unsigned.apk 'my app name' We've done this with every…
Psest328
  • 6,575
  • 11
  • 55
  • 90
1
vote
1 answer

Certificate chain not found for: . Can I recover it?

I'm developing a Cordova app for IOS and Android, After a year, I made some changes and I want to update the app. The problem begins when I need to sign the android's .apk, I lost my .keystore, found it and included in the project dir ( different…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
1
vote
0 answers

can't install the rebuild app after signed using jarsign

After I got a signed result I tried to install the .apk file, what failed (output) I deployed the .apk file apktool d x.apk then made some chagnes and rebuild the .apk using apktool b x.app I've download root.crt and class3.crt and updated the…
roshik
  • 11
  • 2
1
vote
1 answer

Do apksigner supports timestamp server argument?

jarsigner allows to provide the timestamp server as an argument (-tsa) but apksigner timestamp server argument seems to be missing. apksigner don't support timestamp server argument? apksigner don't need timestamp server argument?
1
vote
1 answer

Unable to sign jar: java.io.IOException: Invalid encoding: redundant leading 0s

After update to JDK 8u131 we cannot sign some jars anymore. We are using ant's task for signing. The signing fails with the following error: [signjar] jarsigner: unable to sign jar: java.io.IOException: Invalid encoding: redundant…
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
1
vote
2 answers

Problem signing jars for web applet

keytool -genkey -keystore myKeyStore -alias me keytool -selfcert -keystore myKeyStore -alias me jarsigner -keystore myKeyStore jarfile.jar me I'm using this way to sign jars. I use my jar and a few more as libraries and all of them are signed this…
Nuno
  • 1,163
  • 1
  • 11
  • 15
1
vote
2 answers

Signed FatJar is really slow at runtime

I have a rather large signed FatJar (~150Mb) and I just tried running it and it turns out that it runs much slower than its unsigned equivalent. I'm using jdk1.8.0_131 (on Mac). I'm curious as to whether this is normal or whether there are some tips…
StFS
  • 1,639
  • 2
  • 15
  • 31
1
vote
1 answer

jarsigner -verify: warning messages - BouncyCastle signed jar

This is new domain for me so not entirely sure how to interpret the available information. Research yields the following relevant posts: Version 1.50 + WebStart: signature not verified java SSL and cert keystore However, still not sure if this is…
Threadid
  • 730
  • 1
  • 7
  • 27