com.pcbsys.nirvana.client.nCertificateValidator Class Reference

This class validates signatures signed by the nCertificateSigner class. More...

Inheritance diagram for com.pcbsys.nirvana.client.nCertificateValidator:

com.pcbsys.nirvana.client.nMessageValidator

Public Member Functions

Object check (byte[] original) throws Exception
 Performs the validation with the original signature against the signature created with the update methods.
java.security.cert.Certificate[] getLoadedCertificates ()
 Returns an array of certificates that this object is using to valdiate the signature.
Provider getProvider ()
 Return the Provider used to vend the Signature class.
 nCertificateValidator (String keystoreName, String keyStorePasswd, String algorithm) throws nIllegalArgumentException, KeyStoreException, FileNotFoundException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchAlgorithmException, InvalidKeyException
 Constructs a Validator object by loading the specified keystore from disk and then loading all the certificates within the keystore to be used to validate the nConsumeEvent signature.
 nCertificateValidator (String keystoreName, String keyStorePasswd) throws nIllegalArgumentException, KeyStoreException, FileNotFoundException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchAlgorithmException, InvalidKeyException
 Constructs a Validator object by loading the specified keystore from disk and then loading all the certificates within the keystore to be used to validate the nConsumeEvent signature.
 nCertificateValidator (KeyStore keystore, String algorithm) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException
 Constructs the Validator object and loads all of the certificate found within the supplied keystore.
 nCertificateValidator (KeyStore keystore) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException
 Constructs the Validator object and loads all of the certificate found within the supplied keystore.
 nCertificateValidator (java.security.cert.X509Certificate[] certificates, String algorithm) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException
 Constructs the validator class with an array of certificates to use.
 nCertificateValidator (java.security.cert.X509Certificate[] certificates) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException
 Constructs the validator class with an array of certificates to use.
void start (byte[] sig)
 Locates the certificate that was used to create the signature.
void stop ()
 Resets this certificate that this class will use for validation.
void update (byte[] data) throws Exception
 Updates the signature with the supplied data.

Static Public Member Functions

static String getDefaultAlgorithm ()
 Get the default algorithm that will be used if no algorithm is supplied.

Detailed Description

This class validates signatures signed by the nCertificateSigner class.

It is constructed with at least one certificate or a list of certificates that it will then use to validate the nConsumeEvents which will be passed to the nSignedEventListener interface. The Object in the go method contains the X509 certificate of the signer.

If the remote certificate can not be found then the error method is called with the signature byte[] as part of the callback


Constructor & Destructor Documentation

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( java.security.cert.X509Certificate[]  certificates  )  throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException

Constructs the validator class with an array of certificates to use.

Parameters:
certificates Array of X509Certificates to use
Exceptions:
nIllegalArgumentException If any parameters are invalid
NoSuchAlgorithmException Algorithm can not be found
InvalidKeyException Unable to access the public keys in the certificates supplied

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( java.security.cert.X509Certificate[]  certificates,
String  algorithm 
) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException

Constructs the validator class with an array of certificates to use.

Parameters:
certificates Array of X509Certificates to use
algorithm Signature algorithm to use
Exceptions:
nIllegalArgumentException If any parameters are invalid
NoSuchAlgorithmException Algorithm can not be found
InvalidKeyException Unable to access the public keys in the certificates supplied

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( KeyStore  keystore  )  throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException

Constructs the Validator object and loads all of the certificate found within the supplied keystore.

Parameters:
keystore Keystore to use
Exceptions:
nIllegalArgumentException If any parameters are invalid
NoSuchAlgorithmException Algorithm can not be found
InvalidKeyException Unable to access the public keys in the certificates supplied
KeyStoreException The keystore supplied is invalid

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( KeyStore  keystore,
String  algorithm 
) throws nIllegalArgumentException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException

Constructs the Validator object and loads all of the certificate found within the supplied keystore.

Parameters:
keystore Keystore to use
algorithm Algorithm to use for the Signature class
Exceptions:
nIllegalArgumentException If any parameters are invalid
NoSuchAlgorithmException Algorithm can not be found
InvalidKeyException Unable to access the public keys in the certificates supplied
KeyStoreException The keystore supplied is invalid

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( String  keystoreName,
String  keyStorePasswd 
) throws nIllegalArgumentException, KeyStoreException, FileNotFoundException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchAlgorithmException, InvalidKeyException

Constructs a Validator object by loading the specified keystore from disk and then loading all the certificates within the keystore to be used to validate the nConsumeEvent signature.

Parameters:
keystoreName Filename of the keystore to use
keyStorePasswd Password/phrase to use to gain access to the keystore
Exceptions:
nIllegalArgumentException If any parameters are invalid
KeyStoreException if KeyStore is in error
FileNotFoundException KeyStore not found
CertificateException Invalid Certificate
NoSuchAlgorithmException Algorithm can not be found
IOException KeyStore failed during load
NoSuchAlgorithmException The algorithm specified can not be located
InvalidKeyException Unable to access the public keys in the certificates supplied

com.pcbsys.nirvana.client.nCertificateValidator.nCertificateValidator ( String  keystoreName,
String  keyStorePasswd,
String  algorithm 
) throws nIllegalArgumentException, KeyStoreException, FileNotFoundException, CertificateException, NoSuchAlgorithmException, IOException, NoSuchAlgorithmException, InvalidKeyException

Constructs a Validator object by loading the specified keystore from disk and then loading all the certificates within the keystore to be used to validate the nConsumeEvent signature.

Parameters:
keystoreName Filename of the keystore to use
keyStorePasswd Password/phrase to use to gain access to the keystore
algorithm Algorithm to use for the Signature class
Exceptions:
nIllegalArgumentException If any parameters are invalid
KeyStoreException if KeyStore is in error
FileNotFoundException KeyStore not found
CertificateException Invalid Certificate
NoSuchAlgorithmException Algorithm can not be found
IOException KeyStore failed during load
NoSuchAlgorithmException The algorithm specified can not be located
InvalidKeyException Unable to access the public keys in the certificates supplied


Member Function Documentation

Object com.pcbsys.nirvana.client.nCertificateValidator.check ( byte[]  original  )  throws Exception

Performs the validation with the original signature against the signature created with the update methods.

Will throw an exception if the signatures do not match

Parameters:
original Original signature
Returns:
The certificate that was used to create the signature
Exceptions:
Exception If the signatures do not match or unable to locate the signing certificate

Implements com.pcbsys.nirvana.client.nMessageValidator.

static String com.pcbsys.nirvana.client.nCertificateValidator.getDefaultAlgorithm (  )  [static]

Get the default algorithm that will be used if no algorithm is supplied.

Currently this is SHA1 with RSA.

Returns:
The Algorithm name that will be used by default

java.security.cert.Certificate [] com.pcbsys.nirvana.client.nCertificateValidator.getLoadedCertificates (  ) 

Returns an array of certificates that this object is using to valdiate the signature.

Returns:
Array of Certificate objects

Provider com.pcbsys.nirvana.client.nCertificateValidator.getProvider (  ) 

Return the Provider used to vend the Signature class.

Returns:
a java.security.Provider class

Implements com.pcbsys.nirvana.client.nMessageValidator.

void com.pcbsys.nirvana.client.nCertificateValidator.start ( byte[]  sig  ) 

Locates the certificate that was used to create the signature.

Then resets this object to use this certificate

Parameters:
sig Original signing object

Implements com.pcbsys.nirvana.client.nMessageValidator.

void com.pcbsys.nirvana.client.nCertificateValidator.update ( byte[]  data  )  throws Exception

Updates the signature with the supplied data.

Parameters:
data data to add
Exceptions:
Exception Depending on the implementation of the signature class

Implements com.pcbsys.nirvana.client.nMessageValidator.