com.dtolabs.rundeck.core.utils
Class JARVerifier

java.lang.Object
  extended by com.dtolabs.rundeck.core.utils.JARVerifier

public final class JARVerifier
extends java.lang.Object

JARVerifier verifies signed JAR files given a list of trusted CA certificates. See http://java.sun.com/products/jce/doc/guide/HowToImplAProvider.html#MutualAuth


Nested Class Summary
static class JARVerifier.VerifierException
          An Exception thrown during verification.
 
Constructor Summary
JARVerifier(java.security.cert.X509Certificate[] trustedCaCerts)
          Create a JAR verifier with an array of trusted certificate authority certificates.
 
Method Summary
static JARVerifier create(java.lang.String keystore, java.lang.String alias, char[] passwd)
          Construct a JARVerifier with a keystore and alias and password.
 void verifySingleJarFile(java.util.jar.JarFile jf)
          Verify the JAR file signatures with the trusted CA certificates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JARVerifier

public JARVerifier(java.security.cert.X509Certificate[] trustedCaCerts)
Create a JAR verifier with an array of trusted certificate authority certificates.

Parameters:
trustedCaCerts -
Method Detail

create

public static JARVerifier create(java.lang.String keystore,
                                 java.lang.String alias,
                                 char[] passwd)
                          throws java.io.IOException,
                                 java.security.KeyStoreException,
                                 java.security.NoSuchAlgorithmException,
                                 java.security.cert.CertificateException
Construct a JARVerifier with a keystore and alias and password.

Parameters:
keystore - filepath to the keystore
alias - alias name of the cert chain to verify with
passwd - password to use to verify the keystore, or null
Returns:
Throws:
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException

verifySingleJarFile

public final void verifySingleJarFile(java.util.jar.JarFile jf)
                               throws java.io.IOException,
                                      java.security.cert.CertificateException,
                                      JARVerifier.VerifierException
Verify the JAR file signatures with the trusted CA certificates.

Parameters:
jf -
Throws:
java.io.IOException
java.security.cert.CertificateException
JARVerifier.VerifierException - If the jar file cannot be verified.