Package com.webmethods.jms.ssl
Class AwSSLEntrust
- java.lang.Object
-
- com.webmethods.jms.ssl.AwSSLEntrust
-
- All Implemented Interfaces:
AwSSL
public class AwSSLEntrust extends java.lang.Object implements AwSSL
Implements the AwSSL interface for the Entrust. The real implementation is in AwSSLEntrustUtil which is used by both jms and java api SSLThis class is design to be stateless. i.e., there is no member variables in this class.
- See Also:
AwSSL
-
-
Field Summary
-
Fields inherited from interface com.webmethods.jms.ssl.AwSSL
CLIENT_WANTS_CLEARTEXT_CONNECTION, CLIENT_WANTS_CLIENT_AUTHENTICATED, CLIENT_WANTS_SERVER_AUTHENTICATID
-
-
Constructor Summary
Constructors Constructor Description AwSSLEntrust()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeSocket(AwSSLSocketInfo socket)
Closes a previously created socket.AwSSLSocketInfo
createClientSocket(AwSSLContext context, int secure, java.lang.String host, int port, int block, boolean encryption)
Creates a client socket with the specified properties.AwSSLContext
createContext(java.lang.String keyfile, java.lang.String trustfile, java.lang.String keystoreType, java.lang.String truststoreType, java.lang.String cipherSuites, java.lang.String password)
AwSSLContext
createSSLContext(java.lang.String keyfile, java.lang.String password)
Creates and initializes an SSL context.void
destroyContext(AwSSLContext context)
Destroys an SSL context.AwSSLCertificate
getCertificate(AwSSLContext context)
Returns the certificate for the supplied Distinguished Name.java.lang.String[]
getDnList(AwSSLContext context)
Returns the list of the Distinguished Names in the keyfile.AwSSLCertificate
getOtherPartysCertificate(AwSSLSocketInfo socket)
Returns the certificate of the other party if the connection was authenticated.java.lang.String[]
getTRList(AwSSLContext context)
Returns the list of the Distinguished Names of trusted roots in the keyfile.boolean
isDnAvailable(AwSSLContext context, java.lang.String dn)
Returns whether or not a certificate for the supplied Distinguished Name is available in the keyfile.boolean
isExportLibrary()
Returns whether this library uses U.S.int
isMoreDataAvailable(AwSSLSocketInfo socket)
Returns the number of bytes that are readable from the socket.boolean
modifyPassword(AwSSLContext context, java.lang.String newpassword)
Changes the password protecting the keyfile.int
read(AwSSLSocketInfo socket, byte[] buffer, int offset, int bytesToRead)
Provided for Entrust Supportbyte[]
read(AwSSLSocketInfo socket, int offset, int bytesToRead)
Reads a number of bytes from the socket and returns the array.boolean
selectEncryptionDn(AwSSLContext context, java.lang.String dn)
Selects the key of for the supplied Distinguished Name as the key for encryption.void
validateSslClientCertificate(AwSSLContext context)
int
write(AwSSLSocketInfo socket, byte[] writebuf)
Writes the array of bytes to the socket and returns the number of bytes written.
-
-
-
Method Detail
-
createSSLContext
public AwSSLContext createSSLContext(java.lang.String keyfile, java.lang.String password) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Creates and initializes an SSL context. The returned context must be presented for all operations.- Specified by:
createSSLContext
in interfaceAwSSL
- Parameters:
keyfile
- The name of the file containing the secret keys.password
- The password for reading the keyfile.- Returns:
- a context handle represented as a long.
- Throws:
java.lang.RuntimeException
- If an error occurs during initialization.
-
createContext
public AwSSLContext createContext(java.lang.String keyfile, java.lang.String trustfile, java.lang.String keystoreType, java.lang.String truststoreType, java.lang.String cipherSuites, java.lang.String password) throws java.lang.RuntimeException
- Specified by:
createContext
in interfaceAwSSL
- Throws:
java.lang.RuntimeException
-
validateSslClientCertificate
public void validateSslClientCertificate(AwSSLContext context) throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
destroyContext
public void destroyContext(AwSSLContext context)
Description copied from interface:AwSSL
Destroys an SSL context. After destroying a context it is no longer valid.- Specified by:
destroyContext
in interfaceAwSSL
- Parameters:
context
- A context handle to be destroyed.
-
isExportLibrary
public boolean isExportLibrary()
Description copied from interface:AwSSL
Returns whether this library uses U.S. Domestic or exportable cipher strengths.- Specified by:
isExportLibrary
in interfaceAwSSL
- Returns:
- true if the library is of export strength only.
-
modifyPassword
public boolean modifyPassword(AwSSLContext context, java.lang.String newpassword) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Changes the password protecting the keyfile. Rewrites the keyfile using the new password.- Specified by:
modifyPassword
in interfaceAwSSL
- Parameters:
context
- A context handle.newpassword
- The new password for the keyfile.- Returns:
- true if the update succeded.
- Throws:
java.lang.RuntimeException
- If an error occurs during the update.
-
getDnList
public java.lang.String[] getDnList(AwSSLContext context) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns the list of the Distinguished Names in the keyfile.
-
getTRList
public java.lang.String[] getTRList(AwSSLContext context) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns the list of the Distinguished Names of trusted roots in the keyfile.
-
selectEncryptionDn
public boolean selectEncryptionDn(AwSSLContext context, java.lang.String dn) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Selects the key of for the supplied Distinguished Name as the key for encryption.- Specified by:
selectEncryptionDn
in interfaceAwSSL
- Parameters:
context
- A context handle.dn
- The Distinguished Name whose key should be selected.- Returns:
- true if the operation succeeded.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
isDnAvailable
public boolean isDnAvailable(AwSSLContext context, java.lang.String dn) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns whether or not a certificate for the supplied Distinguished Name is available in the keyfile.- Specified by:
isDnAvailable
in interfaceAwSSL
- Parameters:
context
-dn
-- Returns:
- true if a certificate is available.
- Throws:
java.lang.RuntimeException
-
getCertificate
public AwSSLCertificate getCertificate(AwSSLContext context) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns the certificate for the supplied Distinguished Name.- Specified by:
getCertificate
in interfaceAwSSL
- Parameters:
context
- A context handle.- Returns:
- a reference to an AwSSLCertificate object if successful, or nil otherwise.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.- See Also:
AwSSLCertificate
-
createClientSocket
public AwSSLSocketInfo createClientSocket(AwSSLContext context, int secure, java.lang.String host, int port, int block, boolean encryption) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Creates a client socket with the specified properties.- Specified by:
createClientSocket
in interfaceAwSSL
- Parameters:
context
- A context handle.secure
- The security properties of the socket (set to the selected CLIENT_* values above).host
- The name of the host to which the socket should connect.port
- The portnumber to which the socket should connect.block
- Set to 1 if the socket should be blocking, 0 for non-blocking.- Returns:
- a reference to an AwSSLSocketInfo object if successful, or nil otherwise.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.- See Also:
AwSSLSocketInfo
-
closeSocket
public void closeSocket(AwSSLSocketInfo socket) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Closes a previously created socket.- Specified by:
closeSocket
in interfaceAwSSL
- Parameters:
socket
- The sockethandle returned in the AwSSLSocketInfo object.- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
read
public byte[] read(AwSSLSocketInfo socket, int offset, int bytesToRead) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Reads a number of bytes from the socket and returns the array.- Specified by:
read
in interfaceAwSSL
- Parameters:
socket
- The sockethandle returned in the AwSSLSocketInfo object.bytesToRead
- The number of bytes to read from the socket.- Returns:
- an array of the bytes read from the socket if successful, or nil otherwise.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
read
public int read(AwSSLSocketInfo socket, byte[] buffer, int offset, int bytesToRead) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Provided for Entrust Support
-
write
public int write(AwSSLSocketInfo socket, byte[] writebuf) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Writes the array of bytes to the socket and returns the number of bytes written.- Specified by:
write
in interfaceAwSSL
- Parameters:
socket
- The sockethandle returned in the AwSSLSocketInfo object.writebuf
- The array of bytes to write to the socket.- Returns:
- the number of bytes actually written to the socket.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
isMoreDataAvailable
public int isMoreDataAvailable(AwSSLSocketInfo socket) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns the number of bytes that are readable from the socket.- Specified by:
isMoreDataAvailable
in interfaceAwSSL
- Parameters:
socket
- The sockethandle returned in the AwSSLSocketInfo object.- Returns:
- the number of bytes readable from the socket.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
getOtherPartysCertificate
public AwSSLCertificate getOtherPartysCertificate(AwSSLSocketInfo socket) throws java.lang.RuntimeException
Description copied from interface:AwSSL
Returns the certificate of the other party if the connection was authenticated.- Specified by:
getOtherPartysCertificate
in interfaceAwSSL
- Parameters:
socket
- The sockethandle returned in the AwSSLSocketInfo object.- Returns:
- an object reference to an AwSSLCertificate object if successful, or nil otherwise.
- Throws:
java.lang.RuntimeException
- If an error occurs during the operation.
-
-