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

Signing jar created with onejar-maven-plugin throwing stackoverflow exception

I have a jar which is created using onejar-maven-plugin, which is meant to listen to jms messages from tibco and process accordingly. It works fine but when I sign this jar using jarsigner and try to run it, it throws the exception…
3
votes
0 answers

Error when trying to sign a .apk file

I am having a problem with signing my unsigned .apk file. When ever I try to enter this command jarsigner –verbose –sigalg MD5withRSA –digestalg SHA1 –keystore my-release-key.keystore AmazonInAppSample-release-unsigned.apk alias_name I get this…
3
votes
1 answer

Signing Android APK using Release

I have created an Android App using Eclipse. I can't upload it to Android Market because it is signed using debug mode. I want to Sign it in Release mode, I read the Tutorial Basic Setup for Signing, I also installed the keytool but don't know how…
user1541967
3
votes
0 answers

Signing Java Applet - "Keystore was tampered with, or password was incorrect"

I have a .cer file from a certificate authority (internal). I've imported it into a keystore using the following command: keytool -import -alias javaapplet -file certificate.cer -keystore javasign I entered a keystore password twice and the keystore…
Andrew M
  • 4,208
  • 11
  • 42
  • 67
2
votes
2 answers

Ant Build Signing Jar

I'm still getting the following error message when I try to install on the Android device. Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES] I updated Ant to the latest version 1.8.3 that addresses this issue when used with Java…
Anthony
  • 65
  • 1
  • 1
  • 7
2
votes
1 answer

Android APK re-signing :Certificate chain not validated

I am trying to re-sign the existing android application. But I get a message "This jar contains entries whose certificate chain is not validated.". Even though my jar is properly verified. I would like to know what are the steps for re-signing the…
EnthuDeveloper
  • 672
  • 9
  • 25
2
votes
1 answer

Ensure all Jar files that are run, are signed, and are signed by me?

I have a Java Desktop application. I'm trying to find a way to download updated jars, and run them without my users having to completely re-install their application. I need to do this safely, and want to verify that 1. the Jars I run haven't been…
2
votes
2 answers

Why do I get "no manifest." and "jar is unsigned." when doing "jarsigner -verify -verbose -certs" for my APK

I have one of my Android projects producing unsigned APKs. I'm using below provided configuration and then verifying produced APKs. I'm sure Gradle is using my provided keystore file because I tried changing the path and password and the build was…
ViliusK
  • 11,345
  • 4
  • 67
  • 71
2
votes
1 answer

Signed apk unable to install in Android 12

I got 'App not installed as package appears to be invalid' message when trying to install my signed release app manually on Android 12. However, it can be installed in my other phones which are Android 9 and Android 6. I use jarsigner to sign my apk…
Jun
  • 23
  • 3
2
votes
2 answers

JarSigner done within java?

Is it possible to use the JarSigner class to sign a jar file within java? Currently I am using: String args[] = {"-keystore", keystore, "-storepass", password, jar, keyname}; JarSigner js = new JarSigner(); js.run(args); but if anything fails, the…
wuntee
  • 12,170
  • 26
  • 77
  • 106
2
votes
1 answer

Android Studio Generate Signed Bundle: keystore load: Keystore was tampered with, or password was incorrect

I have been checking all over the internet and nothing seems to be working. In Android Studio, once I click Build -> Generate Signed Bundle I all of a sudden get the issue stated above. The thing is, I was able to generate a signed bundle just a few…
Ziggy
  • 491
  • 1
  • 6
  • 17
2
votes
1 answer

How to sign a .jar file using XMSS (PQC) Signature Scheme with JarSigner

I am trying to use JarSigner to sign .jar files with XMSS Signatures. With the use of the JCA/JCE Post-Quantum Cryptography Provider from BouncyCastle it is possible to generate XMSS and XMSSMT KeyPairs programmatically (example). In order to use…
whme
  • 4,908
  • 5
  • 15
  • 28
2
votes
1 answer

How to fix jarsigner issue used in command line windows giving "SocketException: Permission denied: connect"

I am trying to run the following jarsigner command: jarsigner -keystore C:/keystore.p12 -storepass xyz jars_to_be_signed.jar friendly_name -tsa http://sha256timestamp.ws.symantec.com/sha256/timestamp -storetype pkcs12 signedjar …
2
votes
1 answer

jarsigner: The signer’s certificate chain is not validated

Today I stumbled upon the weird jarsigner warning: "The signer’s certificate chain is not validated." whilst trying to sign jars. Recently I got a new keystore (PKCS12) containing my new certificate. Why ever it seemed like there were some…
BullshitPingu
  • 79
  • 2
  • 6
2
votes
0 answers

Maven execute plugin just before creating war but after archiving classes

My main problem is I have to sign all the JARs of WEB-INF\lib folder. So this is what I have done:- Enabled archiveClasses option to package classes also into JAR Added JAR-Signer Plugin and setting the archive directory to…
kleash
  • 1,211
  • 1
  • 12
  • 31