com.pcbsys.nirvana.client.nCertificateSigner Class Reference

This class signs nConsumeEvents as they are published to the Realm Server. More...

Inheritance diagram for com.pcbsys.nirvana.client.nCertificateSigner:
com.pcbsys.nirvana.client.nMessageSigner

Public Member Functions

Provider getProvider ()
 Return the Provider used to vend the Signature class. More...
 
 nCertificateSigner (java.security.cert.X509Certificate cert, java.security.PrivateKey key) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException
 Constructs a Signer class using the supplied Certificate and private key. More...
 
 nCertificateSigner (java.security.cert.X509Certificate cert, java.security.PrivateKey key, String algorithm) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException
 Constructs a Signer class using the supplied Certificate, private key and will use the algorithm supplied to sign the event. More...
 
 nCertificateSigner (KeyStore keystore, String alias, String privKeyPassword) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, UnrecoverableKeyException
 Constructs a signer class using the keystore and alias. More...
 
 nCertificateSigner (KeyStore keystore, String alias, String privKeyPassword, String algorithm) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, UnrecoverableKeyException
 Constructs a signer class using the keystore, alias and an algorithm The certificate specified by the alias is then used as well as the private key for the certificate. More...
 
 nCertificateSigner (String keystoreName, String keyStorePasswd, String alias, String privKeyPassword) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, FileNotFoundException, IOException, CertificateException, UnrecoverableKeyException
 Constructs a signature class use a keystore specified by the filename. More...
 
 nCertificateSigner (String keystoreName, String keyStorePasswd, String alias, String privKeyPassword, String algorithm) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, FileNotFoundException, CertificateException, IOException, UnrecoverableKeyException
 Constructs a signature class use a keystore specified by the filename, and the algorithm specified. More...
 
byte[] sign () throws Exception
 Creates a signature from the data passed in using the update method. More...
 
void update (byte[] data) throws Exception
 Adds the data to the signature. More...
 

Static Public Member Functions

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

Detailed Description

This class signs nConsumeEvents as they are published to the Realm Server.

It requires the Java Crypto API (JCE) be installed so that the required algorithm can be found.

Constructor & Destructor Documentation

com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( java.security.cert.X509Certificate  cert,
java.security.PrivateKey  key 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException

Constructs a Signer class using the supplied Certificate and private key.

Parameters
certX509Certificate that will be used to sign
keyThe private key for the certificate
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( java.security.cert.X509Certificate  cert,
java.security.PrivateKey  key,
String  algorithm 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException

Constructs a Signer class using the supplied Certificate, private key and will use the algorithm supplied to sign the event.

Parameters
certX509Certificate that will be used to sign
keyThe private key for the certificate
algorithmAlgorithm to use
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( KeyStore  keystore,
String  alias,
String  privKeyPassword 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, UnrecoverableKeyException

Constructs a signer class using the keystore and alias.

The certificate specified by the alias is then used as well as the private key for the certificate.

Parameters
keystoreJava keystore containing the certificate to use
aliasString name of the certificate
privKeyPasswordPassword/phrase to use to gain access to the private key
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
KeyStoreExceptionThe keystore supplied is invalid
UnrecoverableKeyExceptionUnable to recover from a key error
com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( KeyStore  keystore,
String  alias,
String  privKeyPassword,
String  algorithm 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, UnrecoverableKeyException

Constructs a signer class using the keystore, alias and an algorithm The certificate specified by the alias is then used as well as the private key for the certificate.

Parameters
keystoreJava keystore containing the certificate to use
aliasString name of the certificate
privKeyPasswordPassword/phrase to use to gain access to the private key
algorithmAlgorithm to use
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
KeyStoreExceptionThe keystore supplied is invalid
UnrecoverableKeyExceptionUnable to recover from a key error
com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( String  keystoreName,
String  keyStorePasswd,
String  alias,
String  privKeyPassword 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, FileNotFoundException, IOException, CertificateException, UnrecoverableKeyException

Constructs a signature class use a keystore specified by the filename.

This constructor will load the keystore from disk and then load the certificate from the keystore to use. The keystore must exist.

Parameters
keystoreNameFile name of the keystore to use
keyStorePasswdPassword/phrase used to access the keystore
aliasThe name of the certificate within the keystore to use
privKeyPasswordThe password/phrase used to access the private key of the certificate
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
KeyStoreExceptionThe keystore supplied is invalid
UnrecoverableKeyExceptionUnable to recover from a key error
FileNotFoundExceptionKeyStore does not exist
IOExceptionUnable to load the keystore supplied
CertificateExceptionif the certificate found has exceptions
com.pcbsys.nirvana.client.nCertificateSigner.nCertificateSigner ( String  keystoreName,
String  keyStorePasswd,
String  alias,
String  privKeyPassword,
String  algorithm 
) throws nIllegalArgumentException, CertificateExpiredException, CertificateNotYetValidException, NoSuchAlgorithmException, InvalidKeyException, KeyStoreException, FileNotFoundException, CertificateException, IOException, UnrecoverableKeyException

Constructs a signature class use a keystore specified by the filename, and the algorithm specified.

This constructor will load the keystore from disk and then load the certificate from the keystore to use. The keystore must exist.

Parameters
keystoreNameFile name of the keystore to use
keyStorePasswdPassword/phrase used to access the keystore
aliasThe name of the certificate within the keystore to use
privKeyPasswordThe password/phrase used to access the private key of the certificate
algorithmAlgorithm to use
Exceptions
nIllegalArgumentExceptionIf any arguments are invalid
CertificateExpiredExceptionIf the supplied certificate has expired
CertificateNotYetValidExceptionIf the supplied certificate is yet to become valid
NoSuchAlgorithmExceptionUnable to locate the specific algorithm
InvalidKeyExceptionIf unable to access the private / public key supplied
KeyStoreExceptionThe keystore supplied is invalid
UnrecoverableKeyExceptionUnable to recover from a key error
FileNotFoundExceptionKeyStore does not exist
CertificateExceptionif the certificate found has exceptions
IOExceptionUnable to load the keystore supplied

Member Function Documentation

static String com.pcbsys.nirvana.client.nCertificateSigner.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
Provider com.pcbsys.nirvana.client.nCertificateSigner.getProvider ( )

Return the Provider used to vend the Signature class.

Returns
a java.security.Provider class

Implements com.pcbsys.nirvana.client.nMessageSigner.

byte [] com.pcbsys.nirvana.client.nCertificateSigner.sign ( ) throws Exception

Creates a signature from the data passed in using the update method.

Returns
a byte[] representing the signature
Exceptions
ExceptionIf unable to produce a signature

Implements com.pcbsys.nirvana.client.nMessageSigner.

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

Adds the data to the signature.

Parameters
dataData to add to the signature
Exceptions
Exceptionif unable to process the data

Implements com.pcbsys.nirvana.client.nMessageSigner.