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

Ionic apk signing error

Currently trying to sign my apk which has been built with ionic v2 following the exact procedure advised by ionic in their docs: http://ionicframework.com/docs/v1/guide/publishing.html But for some reason, I am getting this error when uploading to…
Jack Collins
  • 57
  • 1
  • 2
  • 7
2
votes
1 answer

Double-Signing .apk // SHA1 & other issues

I am currently facing some problems with double-signing an .apk. The normal workflow was always: zip -d FILE.apk META-INF/\* jarsigner -verbose -keystore EXTERNAL.keystore FILE.apk EXTERNAL jarsigner -verbose -keystore INTERNAL FILE.apk…
2
votes
2 answers

Jarigner: unable to open jar file

I have searched a lot about this issue and everything I've found didn't seem to help. I am trying to sign my cordova app in android with the following command: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key_file_name.keystore…
Robby
  • 71
  • 7
2
votes
2 answers

Jarsigner is not recognized as an internal or external command

I have an ionic application that I want to publish on the google play store. I have set the path, but I cant sign the unsigned apk. I am using a cmd to do this. My apk and my keystore are not in the same map. Maybe that is the problem? Thanks in…
Mret sezen
  • 73
  • 2
  • 7
2
votes
1 answer

Jarsigner - alias contains diacritic sign

it's my first post here. I would like to ask for help. I have a problem with signing .jar application. I don't know how to specify alias in jarsigner command, which contains diacritic sign. I have a Code Signing certificate. My alias (Pa Zówka)…
Paula
  • 21
  • 2
2
votes
0 answers

Programmatically compute "SHA-256-Digest-Manifest-Main-Attributes" in jar file?

Because of using HSM hardware we need to sign a jar file w/o actually using Jarsigner. It's all pretty obvious, to the exception of the SHA256 digest of the manifest's main attributes, the attribute "SHA-256-Digest-Manifest-Main-Attributes" in the…
Jan Goyvaerts
  • 2,913
  • 4
  • 35
  • 48
2
votes
0 answers

How can I change the SHA256 to SHA1 of apk signer

I have apk file signed by SHA256. Step1) I deleted the sign, zip -d ./myapp.apk 'META-INF/*' step2) Check sign was correctly deleted keytool -list -printcert -jarfile ./myapp.apk Step3) I re-signed my application with SHA1 jarsigner -verbose…
whitebear
  • 11,200
  • 24
  • 114
  • 237
2
votes
1 answer

What's the point of the *.SF file in jarsigner?

I'm looking into how jarsigner works and the purpose of each file in the META-INF folder. As I understand, MANIFEST.MF contains a listing of every file in the zip/jar along with a digest of it. The *.SF file contains a digest of the manifest file,…
F.A.
  • 602
  • 1
  • 7
  • 15
2
votes
3 answers

How to Sign the jar file in Gradle

I need to Sign the jar file. I did that applying plugin "signing" and add block sign like below: apply plugin: 'signing' signing { required { gradle.taskGraph.hasTask("makeService") } sign configurations.archives } At the end I am able to add PGP…
Slok
  • 91
  • 2
  • 7
2
votes
1 answer

jarsigner with timestamp but the error responder's certificate not within the validity period

I have signed the jars with timestamp for the certificate that expires on jan-2017. I changed my system time to after jan-2017. When I run applet that downloads above jars, I get the error responder's certificate not within the validity period. As…
2
votes
1 answer

Signing and aligning APK Step in Visual Studio Team Services (was Visual Studio Online)

I try to run my Signing and aligning APK Step on my Mac Build Server but, when I run it I get an following error... TypeError: Path must be a string. Received undefined Return code: 1 Below, I put my screenshot with configuration : I am sure that…
Mariusz
  • 233
  • 1
  • 3
  • 8
2
votes
0 answers

Getting error when signing apk

Iv'e just made an apk file in kivy using buildozer with https://groups.google.com/forum/#!topic/kivy-users/pBtbg8aSlNo as reference: $ cd $ mkdir keystores $ keytool -genkey -v -keystore ./keystores/xyz.keystore -alias XYZ -keyalg RSA -keysize 2048…
2
votes
1 answer

Unable to sign apk file using jarsigner

I am signing my apk using the below command: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mykeystore.keystore myApp.apk aliasname The log ends with . . . signing: org/achartengine/image/zoom-1.png signing:…
Ahmed Faisal
  • 4,397
  • 12
  • 45
  • 74
2
votes
2 answers

How to sign a jar with a smartcard

I'm using a PKCS11 smartcard at work, and would like to use jarsigner to sign jar files using the certificate on my card. I'm mostly working on Linux. Coolkey can see the card. Oracle's documentation mentions smartcards: jarsigner -keystore NONE…
Gary B
  • 523
  • 4
  • 15
2
votes
1 answer

jarsigner "Only one alias can be specified" 3

I perused questions 13335419, 8748089, 4282405, and a few others. They indicated that the most likely cause is an embedded space. Another answer was a possible certificate problem. I used this tutorial as a guide. I had a real certificate issued,…
Sarah Weinberger
  • 15,041
  • 25
  • 83
  • 130