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

Looking for help to use Google Cloud HSM with jarsigner to sign jar files

I need to sign jar files using Google Cloud HSM. The standard tool for signing jar files that comes with the JDK is jarsigner. I see that AWS Cloud HSM has documentation on using AWS Cloud HSM with jarsigner to sign jar…
Ajoy Bhatia
  • 603
  • 6
  • 30
1
vote
0 answers

JAR Signing Java using digital certificate

Hope you are all doing well.. I am signing my jars for the first time and for this your genuine help is required.. problem I am facing is I do not know the steps of jar signing with trusted certificate(ssl.com) not self signed jar.. please help and…
1
vote
2 answers

Android maven jarsigner, jarsigner: attempt to rename X but failed

I want to sign an android .apk, I've got the following profile setup in my pom.xml
Jimmy
  • 16,123
  • 39
  • 133
  • 213
1
vote
1 answer

How do I install jarsigner on Amazon Linux 2?

My understanding is that jarsigner is packaged with OpenJDK, which I've installed by running sudo amazon-linux-extras install java-openjdk11 Now I have a bunch of synlinks to the jdk, like so: $ ll /etc/alternatives/jre* lrwxrwxrwx 1 root root 60…
Cody
  • 2,467
  • 2
  • 21
  • 30
1
vote
2 answers

How to Un-Jarsign my APK?

If I have a JAR (Android APK), and I signed it like this: jarsigner -keystore my.keystore someApk.apk myAlias How do I un-sign it? Because if I open it as a zip file and try to extract the AndroidManifest.xml, they are all messed up.
Isaac Waller
  • 32,709
  • 29
  • 96
  • 107
1
vote
1 answer

Android Studio Signing - Unable to locate jarsigner

I ran into this exception while trying to build an Android App Bundle (.aab). Below is the exception which is reported : java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: jarsignerfailed with exit code…
1
vote
2 answers

Signing a jar with jarsigner using a PFX file

What I've done is the following: Creating a ca.key and ca.cert Creating a server.key and server.csr Signing the CSR with the CA, creating a server.cert Creating a pfx using the server.cert and server.key All this using OpenSSL. Now I want to sign…
YoavKlein
  • 2,005
  • 9
  • 38
1
vote
1 answer

Signing APK by commandline

I am developing android applications with Eclipse and the Android SDK. For testing the app on a device it is pretty embarrasing to do the same job every time: Android Tools Export Signed Application Package Select project Select keystore Use…
Marco
  • 960
  • 2
  • 7
  • 26
1
vote
1 answer

Alternative for GPG signature to publish JAR in maven central

I am new to JAVA development and was working to publish the JAR in maven central for open access. It was mentioned in offical maven page that artifacts must be signed using GPG signature , i would like to know is there any other alternative software…
Karthikk
  • 326
  • 2
  • 7
1
vote
4 answers

Do I need to resign apk every time I make a change?

I am making my first app and just signed and did all that to make a official signed, non debugging apk. Now, if I want to make a small change, do I need to go through all the resigning again, and use the same key, or what?
Andrew
  • 830
  • 3
  • 10
  • 27
1
vote
0 answers

invalid SHA-256 signature file digest

I tried to sign my android application, using the command line in Linux. When I want to check if it is signed using the command: jarsigner -verify -verbose -certs myapp__armeabi-v7a-0.1-armeabi-v7a-debug.apk I got this error: invalid SHA-256…
Reihaneh Kouhi
  • 489
  • 1
  • 7
  • 23
1
vote
1 answer

Phonegap APK - jarsigner -verify throwing an error - invalid SHA-256 signature file digest for res/layout/notification_action.xml

I have created the keystore using keytool -genkey -v -keystore xx_yy_zz.keystore -alias xx_yy_zz_alias_name -keyalg RSA -keysize 2048 -validity 10000 Uploaded to Phonegap and generated a APK file The signed the APK using the below command jarsigner…
Bhavika Patel
  • 35
  • 1
  • 8
1
vote
1 answer

Jarsigner - This jar contains entries whose certificate chain is invalid. Reason: PKIX path building failed:

For school, I need to sign a jar and was provided with the following tutorial https://docs.oracle.com/javase/tutorial/security/toolsign/. So, I start with making and compiling a simple Program that prints "Hello World!" and put it in a jar with the…
user9578896
1
vote
2 answers

Jarsigner will not open

Ok I need some help here !! I am working with Windows 7 Home Premium and I have downloaded and installed the jdk6u25x64 and the android sdk. here in lies the problem. I have an app ready to publish and I have made the .apk file. now I need to sign…
1
vote
1 answer

JavaFX 12 - Invalid signature file digest for Manifest main attributes

Im developing a sample of JavaFX 12, but when generate a JAR file to execute i get this error: java -jar target/JRPrintPreview-1.0-SNAPSHOT.jar Error: A JNI error has occurred, please check your installation and try again Exception in thread "main"…
Paulo Coutinho
  • 705
  • 1
  • 7
  • 15