|
IAIK TSP version 2.32 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.net.Socket iaik.security.ssl.SSLSocket iaik.tsp.transport.ssl.TspSSLClientSocket
public class TspSSLClientSocket
This class extends the SSLSocket
to provide sending and
receiving of TimeStampReq
and
TimeStampResp
over SSL.
The protocol basically assumes a listener process on a TSA that can accept TSA messages on a well-defined port (default IP port number 318).
In the RFC 3161 are five different response formats defined:
SSLSocket
Constructor Summary | |
---|---|
TspSSLClientSocket(java.net.Socket proxySocket,
java.lang.String host,
int port,
int timeOut,
SSLContext context)
Creates a new TspSSLClientSocket and connects it to the
specified port number on the named host via the given proxy. |
|
TspSSLClientSocket(java.lang.String host,
int port,
int timeOut,
SSLContext context)
Creates a new TspSSLClientSocket and connects it to the
specified port number on the named host. |
Method Summary | |
---|---|
TspTcpIpResponse |
sendRequest(TimeStampReq request)
Sends a TimeStampReq to the specified server and receives a
TspTcpIpResponse . |
Methods inherited from class java.net.Socket |
---|
bind, connect, connect, getChannel, getKeepAlive, getLocalSocketAddress, getOOBInline, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setTrafficClass, shutdownInput, shutdownOutput, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TspSSLClientSocket(java.lang.String host, int port, int timeOut, SSLContext context) throws java.net.UnknownHostException, java.io.IOException
TspSSLClientSocket
and connects it to the
specified port number on the named host.
For instance:
String tsaHost = "..."; int tsaPort = ...; int timeOut = ...; //create new Tsp SSL client socket SSLClientContext clientContext = ...; TspSSLClientSocket socket = new TspSSLClientSocket(tsaHost, tsaPort, timeOut, context); TimeStampReq request = ...; TspTcpIpResponse response = socket.sendRequest(request); ...
host
- The host name.port
- The port number.timeOut
- Enable/disable SO_TIMEOUT with the specified timeout, in
milliseconds. A timeout of zero is interpreted as an infinite
timeout.context
- The SSLContext to be used.
java.net.UnknownHostException
- Thrown to indicate that the IP address of a host could not be
determined.
java.io.IOException
- If an I/O error occurs when creating the socket.public TspSSLClientSocket(java.net.Socket proxySocket, java.lang.String host, int port, int timeOut, SSLContext context) throws java.net.UnknownHostException, java.io.IOException
TspSSLClientSocket
and connects it to the
specified port number on the named host via the given proxy.
For instance, when using JDK 1.5 or later, a Proxy
object may be used to create the proxy socket, e.g.:
String proxyHost = "..."; int proxyPort = ...; SocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort); Proxy proxy = new Proxy(Proxy.Type.SOCKS, proxyAddr); Socket proxySocket = new Socket(proxy); proxySocket.setSoTimeout(30000); String tsaHost = "..."; int tsaPort = ...; InetSocketAddress tsaAddr = new InetSocketAddress(tsaHost, tsaPort); proxySocket.connect(tsaAddr); //create new Tsp SSL client socket SSLClientContext clientContext = ...; TspSSLClientSocket socket = new TspSSLClientSocket(proxySocket, tsaHost, tsaPort, 60000, context); TimeStampReq request = ...; TspTcpIpResponse response = socket.sendRequest(request); ...
proxySocket
- The proxy socket used to connect to the tsa server.host
- The TSA host name.port
- The TSA port number.timeOut
- Enable/disable SO_TIMEOUT with the specified timeout, in
milliseconds. A timeout of zero is interpreted as an infinite
timeout.context
- The SSLContext to be used.
java.net.UnknownHostException
- Thrown to indicate that the IP address of a host could not be
determined.
java.io.IOException
- If an I/O error occurs when creating the socket.Method Detail |
---|
public TspTcpIpResponse sendRequest(TimeStampReq request) throws java.io.IOException, TspTcpIpFormatException, CodingException
TimeStampReq
to the specified server and receives a
TspTcpIpResponse
.
request
- The TimeStampReq
to send.
TspTcpIpResponse
.
java.io.IOException
- Thrown if any I/O exception occurs during transport.
TspTcpIpFormatException
- Thrown if the received message is neither a finalMsgRep nor an errorMsgRep.
CodingException
- Thrown if the received TimeStampResp
could not be parsed.
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |