com.rsa.swsj
Class SWSJContext

java.lang.Object
  extended bycom.rsa.swsj.SWSJContext

public final class SWSJContext
extends java.lang.Object

This class collects a number of common parameters and state variables. SWSJContext is a variable that must be created to use the Secure-WS-J toolkit. It holds properties that various APIs in the toolkit use, such as an instance of an implementation of XMLSecurityHandler an instance of an implementation of CertValidator, the set of trusted and intermediate certificates.


Constructor Summary
SWSJContext()

Creates the SWSJ context with the default providers.

SWSJContext(java.security.Provider[] jceProviders)

Creates SWSJ context with the requested list of providers.

SWSJContext(java.lang.String[] jceProviderNames)

Creates the SWSJ context with the requested list of providers.

 
Method Summary

 CertValidator

getCertValidator()

Gets certificate validator.

 java.security.cert.X509Certificate[]

getIntermediateCerts()

Gets an array of intermediate CA certificates.

 java.security.Provider[]

getJCEProviders()

Gets the array of JCE provider object instances.

 XMLSecurityHandler

getSecurityHandler()

Gets the security handler.

 java.security.cert.X509Certificate[]

getTrustedCerts()

Gets an array of trusted certificates set by the user.

 java.lang.String

getVersion()

Gets the version number.

 void

setCertValidator(CertValidator certValidator)

Sets the certificate validator.

 void

setIntermediateCertificates(java.security.cert.X509Certificate[] certs)

Sets an array of intermediate CA certificates.

 void

setJCEProviders(java.security.Provider[] jceProviders)

Sets the array of JCE provider object instances.

 void

setJCEProviders(java.lang.String[] jceProviderNames)

Initializes the JCE providers to use by name.

 void

setSecurityHandler(XMLSecurityHandler handler)

Sets the security handler.

 void

setTrustedCertificates(java.security.cert.X509Certificate[] certs)

Sets an array of trusted certificates to use during certificate path validation.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWSJContext

public SWSJContext()
            throws ProviderException
Creates the SWSJ context with the default providers. The order in which the providers are searched for support of a cryptographic algorithm depends on the order in which the providers were registered.

Throws:
ProviderException - If the default providers cannot be parsed.

SWSJContext

public SWSJContext(java.lang.String[] jceProviderNames)
            throws InvalidParameterException,
                   ProviderException
Creates the SWSJ context with the requested list of providers. The order in which the providers are searched for support of a cryptographic algorithm depends on the order in which the providers names are specified in the input array. This is a zero-based array; the index of the first provider is 0.

Parameters:
jceProviderNames - The list of JCE providers to use for all cryptographic operations.
Throws:
InvalidParameterException - If jceProviderNames is invalid.
ProviderException

SWSJContext

public SWSJContext(java.security.Provider[] jceProviders)
            throws InvalidParameterException
Creates SWSJ context with the requested list of providers. The order in which the providers are searched for support of a crypographic algorithm depends on the order in which the providers names are specified in the input array. This is a zero-based array; the index of the first provider is 0.

Parameters:
jceProviders - An array of JCE provider objects to use for all cryptographic operations.
Throws:
InvalidParameterException - If jceProviders is invalid.
Method Detail

setJCEProviders

public void setJCEProviders(java.security.Provider[] jceProviders)
                     throws InvalidParameterException
Sets the array of JCE provider object instances. The order in which the providers are searched for support of a cryptographic algorithm depends on the order in which the providers names are specified in the input array. This is a zero-based array; the index of the first provider is 0.

Parameters:
jceProviders - An array of JCE providers to use for all cryptographic operations.
Throws:
InvalidParameterException - If jceProviders is invalid.

setJCEProviders

public void setJCEProviders(java.lang.String[] jceProviderNames)
                     throws InvalidParameterException,
                            ProviderException
Initializes the JCE providers to use by name. The order in which the providers are searched for support of a cryptographic algorithm depends on the order in which the providers names were specified in the input array (with index 0 being the first).

Parameters:
jceProviderNames - An array of JCE provider names to use for all cryptographic operations.
Throws:
InvalidParameterException - If jceProviderNames is invalid.
ProviderException

getJCEProviders

public java.security.Provider[] getJCEProviders()
Gets the array of JCE provider object instances.

Returns:
The array of JCE providers to use cryptographic operations.

setCertValidator

public void setCertValidator(CertValidator certValidator)
Sets the certificate validator. If the caller wants to skip the validation of certificates they must explicitly invoke this method with a null value.

Parameters:
certValidator - The validator to use for certificate validation.

getCertValidator

public CertValidator getCertValidator()
Gets certificate validator.

Returns:
The certificate validator currently set.

setSecurityHandler

public void setSecurityHandler(XMLSecurityHandler handler)
                        throws InvalidParameterException
Sets the security handler.

Parameters:
handler - The object that provides additional data for security operations.
Throws:
InvalidParameterException - If handler is invalid.

getSecurityHandler

public XMLSecurityHandler getSecurityHandler()
Gets the security handler.

Returns:
The object that provides additional data for security operations.

getVersion

public java.lang.String getVersion()
Gets the version number.

Returns:
The product version number.

setTrustedCertificates

public void setTrustedCertificates(java.security.cert.X509Certificate[] certs)
                            throws InvalidParameterException
Sets an array of trusted certificates to use during certificate path validation.

Parameters:
certs - An array of trusted certificates.
Throws:
InvalidParameterException - If certs is invalid.

setIntermediateCertificates

public void setIntermediateCertificates(java.security.cert.X509Certificate[] certs)
                                 throws InvalidParameterException
Sets an array of intermediate CA certificates. These certificates will be used during certificate path validation.

Parameters:
certs - An array of intermediate certificates.
Throws:
InvalidParameterException - If certs is invalid.

getTrustedCerts

public java.security.cert.X509Certificate[] getTrustedCerts()
Gets an array of trusted certificates set by the user. Note: This method is only used when initializing the default cert validator

Returns:
An array of certificates.

getIntermediateCerts

public java.security.cert.X509Certificate[] getIntermediateCerts()
Gets an array of intermediate CA certificates. Note: This method is only used when initiaziling the default cert validator

Returns:
An array of certificates.