public class ManagerTransportWithSMProxy extends ManagerTransport
ManagerTransport connections.
SMProxyManagerTransport and ManagerTransport objects are created
from the parameters supplied in the entrust.ini file. The following ProxyOrder values are
used to control the Proxy Ordering:
ManagerTransport connection
is determined in the call to isAvailable. This manager
transport connection will continue to be used until another call is
made to isAvailable.
NOTE: A simple TCP/IP connection attempt is used as a connectivity test. For the proxied connection, this test is performed against the proxy server, not the Security Manager.
DEFAULT_CONNECT_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SO_TIMEOUT, in, out, recipientAddress| Constructor and Description |
|---|
ManagerTransportWithSMProxy(IniFile iniFile,
ProxyOrder proxyOrder)
Constructor that takes an entrust.ini file and sets the proxy order.
|
ManagerTransportWithSMProxy(java.lang.String entrustIniFile,
ProxyOrder proxyOrder)
Constructor that takes an entrust.ini file path and sets the proxy order.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginNewSession()
Called whenever a new session or request to the PKI RA is about to be
made.
|
ResourceEvent |
checkStatus(Resource resource)
This method checks if the CA services provided by the
ManagerTransport object are available.
|
void |
dataReady(byte[] data)
Passes messages as a byte array.
|
void |
endSession()
Must be called whenever a session to the PKI RA is complete.
|
java.lang.String |
getAddress()
Returns the PKI RA's address specified by
managerIP in
other methods if it has not been explicitly defined. |
java.security.cert.X509Certificate[] |
getClientCredentials()
Returns the client X509Certificate chain set by the object that implements
this interface.
|
GeneralMessageInfo |
getGeneralMessageInfo(SecureStringBuffer refNum,
AuthorizationCode authCode)
This is a convenience method used to retrieve information about a
User that has not yet been created.
|
java.io.InputStream |
getInputStream()
Returns the input stream to read information from the PKI
RA.
|
java.io.OutputStream |
getOutputStream()
Returns the output stream to write information to the PKI
RA.
|
int |
getPort()
Returns the PKI RA's port
|
int |
getSoConnectTimeout()
Returns the setting for the connection timeout property of the underlying socket,
in milliseconds, for socket based transports.
|
int |
getSoLinger()
Returns the setting for the SO_LINGER property of the underlying socket,
in seconds, for socket based transports.
|
int |
getSoTimeout()
Returns the setting for the SO_TIMEOUT property of the underlying socket,
in milliseconds, for socket based transports.
|
java.security.cert.X509Certificate[] |
getTrustRoots()
Returns the roots of trust that were set in this object, or null if no roots
of trust were set.
|
boolean |
isAvailable()
Determines whether or not the PKI Registration Authority is available.
|
ResourceMonitor |
periodicPoll(int seconds,
ResourceEventHandler handler,
int trigger)
A convienance method that sets up the ManagerTransport object for
polling to ensure PKI service availability.
|
void |
readNegPollRep()
Reads a 'negPollRep' TCP-based PKI message from the underlying transport.
|
byte[] |
readPKIX4Response(boolean getResponse)
Deprecated.
|
byte[] |
readPKIXCMPResponse(boolean getResponse)
This method reads a PKIXCMP message with a TCP stream header.
|
void |
setClientCredentials(java.security.cert.X509Certificate[] chain,
java.security.PrivateKey signingKey)
Set client credentials for authenticating to a server.
|
void |
setClientCredentials(java.security.cert.X509Certificate verificationCertificate,
java.security.cert.X509Certificate caCertificate,
java.security.PrivateKey signingKey)
Deprecated.
|
void |
setSMProxyConfig(SMProxyConfig config)
Sets the SSL configuration for the proxied connection
NOTE: if the proxy settings in the entrust.ini are missing
or invalid, this method
|
void |
setSoConnectTimeout(int timeout)
Sets the Connection Timeout property of the underlying socket, with the specified
timeout in milliseconds, for socket based transports.
|
void |
setSoLinger(boolean on,
int linger)
Enables/Disables the SO_LINGER property of the underlying socket, with the
specified linger time in seconds, for socket based transports.
|
void |
setSoTimeout(int timeout)
Sets the SO_TIMEOUT property of the underlying socket, with the specified
timeout in milliseconds, for socket based transports.
|
void |
setStreams(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String managerIP)
Sets the streams for communication to and from the PKI RA.
|
void |
setTrustRoots(java.security.cert.X509Certificate[] roots,
LdapDirectory directory,
ClientSettings cs)
Sets the TrustRoots used for SSL Authentication.
|
calculateASNLength, DNSLookup, getInstance, getInstance, readManagerTransportMessagepublic ManagerTransportWithSMProxy(java.lang.String entrustIniFile,
ProxyOrder proxyOrder)
throws java.io.FileNotFoundException,
java.lang.Exception
entrustIniFile - the entrust.ini file pathproxyOrder - the proxy orderjava.io.FileNotFoundException - if the entrust.ini file cannot be foundjava.lang.Exception - if any of the configuration parameters are invalidpublic ManagerTransportWithSMProxy(IniFile iniFile, ProxyOrder proxyOrder) throws java.lang.Exception
entrustIniFile - the entrust.ini file pathproxyOrder - the proxy orderjava.lang.Exception - if any of the configuration parameters are invalidpublic ResourceEvent checkStatus(Resource resource)
ManagerTransportcheckStatus in interface PollableResourcecheckStatus in class ManagerTransportResourceEvent,
Resourcepublic ResourceMonitor periodicPoll(int seconds, ResourceEventHandler handler, int trigger)
ManagerTransportResourceMonitor object which can be used to monitor the
ManagerTransport. If a ResourceEventHandler
is specified, it will be used to handle events for this ManagerTransport. The
ResourceEvent trigger threshold value must also be specified as one
of the following:
If ResourceEventHandler is null then the default ResourceOutputHandler
which simply outputs events using the System.out will be used. The ResourceEventHandler
will be added using the ResourceEventProcessor.setEventHandler(ResourceEventHandler)
method.
If the ResourceEvent trigger value is less than 0, then the default value of OKAY (0) will be used.
periodicPoll in class ManagerTransportseconds - the length of time between each pollhandler - a ResourceEventHandler used when this Resource is notified of an eventtrigger - Sets the level at which event notification is triggered by the HeartbeatEventResource,
ResourceEvent,
HttpManagerClient,
HttpsManagerClientpublic void setStreams(java.io.InputStream input,
java.io.OutputStream output,
java.lang.String managerIP)
ManagerTransportsetStreams in class ManagerTransportinput - the input stream to read information from the
RAoutput - the output stream to write information to the
RAmanagerIP - the PKI RA's IP addresspublic java.lang.String getAddress()
ManagerTransportmanagerIP in
other methods if it has not been explicitly defined.getAddress in class ManagerTransportwww.acme.com,
pkix@acme.com)public int getPort()
ManagerTransportgetPort in class ManagerTransportpublic java.io.OutputStream getOutputStream()
ManagerTransportgetOutputStream in class ManagerTransportpublic java.io.InputStream getInputStream()
ManagerTransportgetInputStream in class ManagerTransportpublic void beginNewSession()
ManagerTransport
beginNewSession() closes the existing socket connection, if
there is one, and connects to the PKI RA again to prepare for the
communication request.
If a sub-class of ManagerTransport is created, override this
method and the dataReady() method. Reset the connection to
the RA.
beginNewSession in class ManagerTransportpublic void endSession()
ManagerTransport
endSession() closes the existing socket connection.
If a sub-class of ManagerTransport is created, override this
method and the dataReady() method. Reset the connection to
the RA.
endSession in class ManagerTransportpublic void dataReady(byte[] data)
throws java.io.IOException
ManagerTransport
dataReady(byte[] data) is called when a data message is ready
for the PKI RA. Sub-classes of ManagerTransport can overide
this method and send the data using any method they choose, e-mail or HTTP,
for example. The sub-classes must first have implemented a simliar proxy
mechanism on the PKI RA's side of the connection.
A User object composes a message for the PKI RA and calls
this method, passing the message in a byte array. Usually, a sub-class of
ManagerTransport implements the dataReady() method
and sends the message to the PKI RA. User then calls the
readPKIXCMPResponse() method and expects to receive a byte array containing
the RA's response.
For example, this code fragment illustrates User using
ManagerTransport:
transport.dataReady(messageForManager);
byte[] messageFromManager = transport.read();
dataReady in class ManagerTransportdata - the data that is ready to be sent to the RAjava.io.IOException - thrown if the output stream has been closed before this method
is calledManagerTransport.beginNewSession()@Deprecated
public byte[] readPKIX4Response(boolean getResponse)
throws java.security.GeneralSecurityException
ManagerTransportreadPKIX4Response in class ManagerTransportjava.security.GeneralSecurityException - always@Deprecated
public void setClientCredentials(java.security.cert.X509Certificate verificationCertificate,
java.security.cert.X509Certificate caCertificate,
java.security.PrivateKey signingKey)
ManagerTransportsetClientCredentials in class ManagerTransportpublic void setClientCredentials(java.security.cert.X509Certificate[] chain,
java.security.PrivateKey signingKey)
ManagerTransportsetClientCredentials in class ManagerTransportpublic void setTrustRoots(java.security.cert.X509Certificate[] roots,
LdapDirectory directory,
ClientSettings cs)
throws java.security.cert.CertificateException,
CertificationRootException
ManagerTransportsetTrustRoots in class ManagerTransportjava.security.cert.CertificateExceptionCertificationRootExceptionpublic java.security.cert.X509Certificate[] getClientCredentials()
ManagerTransportgetClientCredentials in class ManagerTransportpublic java.security.cert.X509Certificate[] getTrustRoots()
ManagerTransportgetTrustRoots in class ManagerTransportpublic GeneralMessageInfo getGeneralMessageInfo(SecureStringBuffer refNum, AuthorizationCode authCode) throws EntrustPKIXCMPException
ManagerTransportPKIXCMPUtils.getGeneralMessageInfo(SecureStringBuffer, AuthorizationCode)
For example:
ManagerTransport man = new ManagerTransport("myPkI",829);
GeneralMessageInfo info = man.getGeneralMessageInfo(refNum, authCode);
ClientSettings settings = info.getClientSettings();
getGeneralMessageInfo in class ManagerTransportrefNum - The reference numberauthCode - The Authorization codeEntrustPKIXCMPExceptionpublic boolean isAvailable()
ManagerTransportContacts the PKIX-CMP service of the PKI Registration Authority checking the availability of this service, including its ability to process PKIX-CMP traffic.
isAvailable in class ManagerTransporttrue if the PKI Registration Authority is available;
false otherwisepublic int getSoLinger()
ManagerTransport
This property specifies the number of seconds to linger after the socket is
closed. A value greater than zero indicates that when a call to
ManagerTransport.endSession() is made, the underlying socket
should wait up to the specified number of seconds for any data on the socket
to be written before it is actually closed. A value of zero indicates that
the socket should be closed immediately (but gracefully, without data loss).
A value of -1 indicates that this property is disabled.
By default the SO_LINGER property is enabled with a value of
DEFAULT_SO_LINGER.
getSoLinger in class ManagerTransportpublic int getSoTimeout()
ManagerTransportThis property specifies the number of milliseconds until a blocking operation fails and the control returns an error. A value of zero indicates that the blocking operation should wait indefinitely. A blocking operation can occur when a read operation is done on the InputStream associated with the underlying socket.
By default the SO_TIMEOUT property is enabled with a value of
DEFAULT_SO_TIMEOUT.
getSoTimeout in class ManagerTransportpublic int getSoConnectTimeout()
ManagerTransportThis property specifies the number of milliseconds until a blocking operation fails and the control returns an error. A value of zero indicates that the blocking operation should wait indefinitely. A blocking operation can occur when a connection attempt is made on the InputStream associated with the underlying socket.
By default the connection timeout property is enabled with a value of
DEFAULT_CONNECT_TIMEOUT.
getSoConnectTimeout in class ManagerTransportpublic void setSoLinger(boolean on,
int linger)
throws java.lang.IllegalArgumentException
ManagerTransport
This property specifies the number of seconds to linger after the socket is
closed. A a value greater than zero indicates that when a call to
ManagerTransport.endSession() is made, the underlying socket
should wait up to the specified number of seconds for any data on the socket
to be written before it is actually closed. A value of zero indicates that
the socket should be closed immediately (but gracefully, without data loss).
By default the SO_LINGER property is enabled with a value of
DEFAULT_SO_LINGER.
setSoLinger in class ManagerTransporton - whether or not the SO_LINGER property is enabledlinger - how long to linger for in seconds, if on is
truejava.lang.IllegalArgumentException - if the linger value is negativepublic void setSoTimeout(int timeout)
throws java.lang.IllegalArgumentException
ManagerTransportThis property specifies the number of milliseconds until a blocking operation fails and the control returns an error. A value of zero indicates that the blocking operation should wait indefinitely. A blocking operation can occur when a read operation is done on the InputStream associated with the underlying socket.
By default the SO_TIMEOUT property is enabled with a value of
DEFAULT_SO_LINGER.
setSoTimeout in class ManagerTransporttimeout - the specified timeout in millisecondsjava.lang.IllegalArgumentException - if the timout is negativepublic void setSoConnectTimeout(int timeout)
throws java.lang.IllegalArgumentException
ManagerTransportThis property specifies the number of milliseconds until a blocking operation fails and the control returns an error. A value of zero indicates that the blocking operation should wait indefinitely. A blocking operation can occur when a connection is done on the InputStream associated with the underlying socket.
By default the connection timeout property is enabled with a value of
DEFAULT_CONNECT_TIMEOUT.
setSoConnectTimeout in class ManagerTransporttimeout - the specified timeout in millisecondsjava.lang.IllegalArgumentException - if the timout is negativepublic byte[] readPKIXCMPResponse(boolean getResponse)
throws java.io.IOException,
java.security.GeneralSecurityException
ManagerTransportreadPKIXCMPResponse in class ManagerTransportjava.io.IOExceptionjava.security.GeneralSecurityExceptionpublic void readNegPollRep()
throws java.io.IOException
ManagerTransportA 'negPollRep' is returned by the responder after a 'pkiMsg' containing PKIX-CMP confirmation message has been transported from initiator to responder. Receiving a 'negPollRep' indicates that the transaction has been successfully completed.
readNegPollRep in class ManagerTransportjava.io.IOException - if an error occurs while reading the 'negPollRep' (i.e.
unexpected end of data, incorrect message flag, invalid
message length...)public void setSMProxyConfig(SMProxyConfig config) throws SMProxyException
config - the configuration to setSMProxyException