jarsigner
signs and verifies Java Archive files
TLDR
SYNOPSIS
jarsigner [options] jar-file aliasjarsigner -verify [options] jar-file [alias...]
DESCRIPTION
jarsigner signs and verifies Java Archive (JAR) files. It adds digital signatures to ensure authenticity and integrity, required for signed JARs, Java Web Start style deployments, and Android App Bundles.The tool uses private keys and certificate chains stored in keystores (created with keytool). Signing adds a signature file (.SF) and a signature block (.RSA, .DSA or .EC) under META-INF. Verification checks that contents haven't been modified and validates the signer's certificate chain.
PARAMETERS
-keystore url
Keystore location. Defaults to .keystore in the user's home directory.-storepass pass
Keystore password. Prompted for if omitted; also accepts :env VAR or :file path suffixes.-storetype type
Keystore type (e.g. PKCS12, JKS, PKCS11).-keypass pass
Private key password, if different from the store password.-signedjar file
Name of the signed JAR to write. Without it, the input JAR is overwritten.-sigfile file
Base name for the generated .SF and signature block files.-sigalg algo
Signature algorithm (e.g. SHA256withRSA, SHA384withECDSA). The default depends on the key type and size.-digestalg algo
Digest algorithm for the JAR entries (e.g. SHA-256).-certchain file
Alternative certificate chain file, when the keystore does not contain the full chain.-verify
Verify a signed JAR file.-verbose[:all|:grouped|:summary]
Verbose output when signing or verifying.-certs
Show certificates (with -verify and -verbose).-revCheck
Enable certificate revocation checking.-strict
Treat warnings as errors.-tsa url
Timestamp authority URL.-tsacert alias
Keystore alias of the TSA's public key certificate.-tsadigestalg algo
Digest algorithm used in the timestamping request.-providerName name, -addprovider name, -providerClass class
Use or add a security provider (e.g. SunPKCS11 for hardware tokens).-conf url
Read options from a preconfigured options file.
CAVEATS
Weak algorithms (MD5, SHA-1 signatures, small RSA/DSA keys) are disabled or treated as unsigned by current JDKs. Without -tsa, signatures are considered invalid once the signing certificate expires. Passing -storepass on the command line exposes it in the process list; prefer the prompt or :env/:file.For APK files, jarsigner only produces the legacy v1 (JAR) scheme; modern Android versions require APK Signature Scheme v2 or later, so use apksigner for APKs. jarsigner remains the standard tool for signing .aab bundles.
HISTORY
jarsigner has been part of the JDK since JDK 1.2 (1998), replacing the earlier javakey tool. JAR signing became important for Java applets in browsers and later for Android application distribution. The tool has evolved to support stronger cryptographic algorithms and timestamping.
