Package com.iizix.security
Class JarSigner
- java.lang.Object
- com.iizix.security.JarSigner
public class JarSigner extends java.lang.Object
Helper class to sign a Jar file.- Author:
- Christopher Mindus
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getJarsigner()
Gets the jarsigner executable that is present in the JDK.static void
signJar(java.io.File jarFile, java.security.KeyStore keystore, java.io.File keystoreFile, java.lang.String storetype, java.lang.String storePassword, java.lang.String keyPassword, java.lang.String alias, java.lang.String tsa)
Signs the Jar file.
Method Detail
getJarsigner
public static java.lang.String getJarsigner() throws NotFoundException
Gets the jarsigner executable that is present in the JDK.- Returns:
- The jarsigner executable.
- Throws:
NotFoundException
- If jarsigner[.exe] is not found.
signJar
public static void signJar(java.io.File jarFile, java.security.KeyStore keystore, java.io.File keystoreFile, java.lang.String storetype, java.lang.String storePassword, java.lang.String keyPassword, java.lang.String alias, java.lang.String tsa) throws java.io.IOException
Signs the Jar file.Note: if
tsa
parameter is set, i.e. timestamping is used, an Internet connection must be present, otherwise this call will fail.- Parameters:
jarFile
- The Jar file to sign.keystore
- The keystore, or null for keystore from a file.keystoreFile
- The keystore file must be specified ifkeystore
parameter is null.storetype
- The keystore type, e.g. JKS or PKCS12.storePassword
- The password for the keystore.keyPassword
- The password for the private key, if different thanstorePassword
, null otherwise.alias
- The alias to use.tsa
- The timestamping authority URL, null for none.- Throws:
java.io.IOException
- For I/O errors.