|
IP*Works! SSL V6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--ipworksssl.Ipports
The IPPortS bean facilitates TCP/IP communications by providing an easy interface to system TCP/IP functions. It allows a client application to communicate with a server using stream sockets.
The IPPortS bean is the SSL-enabled equivalent of the
IP*Works! IPPort bean. The main difference is the introduction of a set of
new configuration settings, properties and events that deal
with SSL security. TheSSLProviderconfiguration setting chooses a security
provider subsystem. TheSSLEnabledProtocolsandSSLCipherStrengthconfiguration settings determine which protocols are enabled and at what security level.
The SSLCertStore , SSLCertSubject , and SSLCertEncoded properties are
used to select a
client certificate if the server is requesting client authentication.
TheSSLSecurityFlagsconfiguration setting, together with the SSLServerAuthentication event
allow you to check the server identity and other security attributes.
Finally, the SSLStatus event provides information about the SSL handshake.
Our main goal in designing IPPortS was ease of use.
The bean has a minimum of properties and five events: Connected , DataIn , Disconnected , ReadyToSend , and Error .
The events are relatively self-explanatory.
The connection is attempted by calling the Connect method or setting the Connected property to True, and then waiting for the Connected event. The destination is defined by setting RemoteHost and RemotePort . Data is sent by calling the Send method
with Text as a parameter, or by assigning the data string to the DataToSend property.
To disconnect, you just call the Disconnect method or set the Connected property to False. The Linger property controls how the connection is
terminated.
The operation of the bean is almost completely asynchronous. All the calls except the ones that deal with domain name resolution, operate through asynchronous messages (no blocking calls). The gain in performance is considerable when compared to using blocking calls.
| Field Summary | |
static int |
fwNone
|
static int |
fwSOCKS4
|
static int |
fwSOCKS5
|
static int |
fwTunnel
|
static int |
sslAutomatic
|
static int |
sslExplicit
|
static int |
sslImplicit
|
static int |
sslNone
|
static int |
sstMachine
|
static int |
sstPEMKey
|
static int |
sstPFXBlob
|
static int |
sstPFXFile
|
static int |
sstUser
|
| Constructor Summary | |
Ipports()
|
|
| Method Summary | |
void |
addIpportsEventListener(IpportsEventListener l)
|
java.lang.String |
config(java.lang.String configurationString)
Sets or retrieves a beanconfiguration setting. |
void |
connect(java.lang.String host,
int port)
Connect to a remote host. |
void |
disconnect()
Disconnect from the remote host. |
void |
doEvents()
Processes events from the internal message queue. |
int |
getBytesSent()
The number of bytes actually sent after an assignment to DataToSend . |
byte[] |
getEOL()
Used to break the incoming data stream into chunks separated by EOL. |
java.lang.String |
getFirewallHost()
Name or IP address of firewall (optional). |
java.lang.String |
getFirewallPassword()
A password if authentication is to be used when connecting through the firewall. |
int |
getFirewallPort()
Port of the firewall to connect to. |
int |
getFirewallType()
Determines the type of firewall to connect through. |
java.lang.String |
getFirewallUser()
A user name if authentication is to be used connecting through a firewall. |
java.lang.String |
getLine()
Gets a line of text from the server. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
int |
getLocalPort()
The TCP port in the local host where IPPort binds. |
java.lang.String |
getRemoteHost()
The address of the remote host. |
int |
getRemotePort()
The TCP port in the remote host. |
byte[] |
getSSLAcceptServerCert()
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate. |
byte[] |
getSSLCertEncoded()
The SSL certificate (PEM/base64 encoded). |
byte[] |
getSSLCertStore()
The name of the certificate store for the client certificate. |
java.lang.String |
getSSLCertStorePassword()
The password for the certificate store (if any). |
int |
getSSLCertStoreType()
The type of certificate store for the client certificate. |
java.lang.String |
getSSLCertSubject()
The subject of the certificate used for client authentication. |
byte[] |
getSSLServerCert()
The server certificate for the last established connection. |
java.lang.String |
getSSLServerCertStatus()
The verification status of the server certificate for the last established connection. |
int |
getSSLStartMode()
Determines how the bean starts the SSL negotiation. |
int |
getTimeout()
A timeout for the bean. |
boolean |
isAcceptData()
Enables or disables data reception (the DataIn event). |
boolean |
isConnected()
Triggers a connection or disconnection. |
boolean |
isKeepAlive()
When True, KEEPALIVE packets are enabled (for long connections). |
boolean |
isLinger()
When set to True, connections are terminated gracefully. |
boolean |
isSingleLineMode()
Special mode for line-oriented protocols. |
void |
removeIpportsEventListener(IpportsEventListener l)
|
void |
send(byte[] text)
Send data to the remote host. |
void |
sendLine(java.lang.String text)
Sends a string followed by a newline. |
void |
setAcceptData(boolean acceptData)
Enables or disables data reception (the DataIn event). |
void |
setConnected(boolean connected)
Triggers a connection or disconnection. |
void |
setDataToSend(byte[] dataToSend)
A string of data to be sent to the remote host. |
void |
setEOL(byte[] EOL)
Used to break the incoming data stream into chunks separated by EOL. |
void |
setFirewallHost(java.lang.String firewallHost)
Name or IP address of firewall (optional). |
void |
setFirewallPassword(java.lang.String firewallPassword)
A password if authentication is to be used when connecting through the firewall. |
void |
setFirewallPort(int firewallPort)
Port of the firewall to connect to. |
void |
setFirewallType(int firewallType)
Determines the type of firewall to connect through. |
void |
setFirewallUser(java.lang.String firewallUser)
A user name if authentication is to be used connecting through a firewall. |
void |
setKeepAlive(boolean keepAlive)
When True, KEEPALIVE packets are enabled (for long connections). |
void |
setLinger(boolean linger)
When set to True, connections are terminated gracefully. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setLocalPort(int localPort)
The TCP port in the local host where IPPort binds. |
void |
setRemoteHost(java.lang.String remoteHost)
The address of the remote host. |
void |
setRemotePort(int remotePort)
The TCP port in the remote host. |
void |
setSingleLineMode(boolean singleLineMode)
Special mode for line-oriented protocols. |
void |
setSSLAcceptServerCert(byte[] SSLAcceptServerCert)
Instructs the bean to unconditionally accept the server certificate that matches the supplied certificate. |
void |
setSSLCertEncoded(byte[] SSLCertEncoded)
The SSL certificate (PEM/base64 encoded). |
void |
setSSLCertStore(byte[] SSLCertStore)
The name of the certificate store for the client certificate. |
void |
setSSLCertStorePassword(java.lang.String SSLCertStorePassword)
The password for the certificate store (if any). |
void |
setSSLCertStoreType(int SSLCertStoreType)
The type of certificate store for the client certificate. |
void |
setSSLCertSubject(java.lang.String SSLCertSubject)
The subject of the certificate used for client authentication. |
void |
setSSLStartMode(int SSLStartMode)
Determines how the bean starts the SSL negotiation. |
void |
setTimeout(int timeout)
A timeout for the bean. |
void |
startSSL()
starts SSL negotiation on a plaintext connection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int fwNone
public static final int fwTunnel
public static final int fwSOCKS4
public static final int fwSOCKS5
public static final int sstUser
public static final int sstMachine
public static final int sstPFXFile
public static final int sstPFXBlob
public static final int sstPEMKey
public static final int sslAutomatic
public static final int sslImplicit
public static final int sslExplicit
public static final int sslNone
| Constructor Detail |
public Ipports()
| Method Detail |
public boolean isAcceptData()
DataIn event).
Setting the property to False, temporarily disables data reception
(and the DataIn event). Setting the property to True, re-enables
data reception.
public void setAcceptData(boolean acceptData)
throws IPWorksSSLException
DataIn event).
Setting the property to False, temporarily disables data reception
(and the DataIn event). Setting the property to True, re-enables
data reception.
IPWorksSSLExceptionpublic int getBytesSent()
DataToSend .
The BytesSent property shows how many bytes were sent after the last
assignment to DataToSend . Please check the DataToSend property for more
information.
public boolean isConnected()
Setting the Connected property to True makes the bean attempt
to connect to the host identified by the RemoteHost property.
If successful, after the connection is achieved the value of the
property changes to True and the Connected event is fired.
Setting Connected to False closes the connection. How and when the
connection is closed is controlled by the Linger property.
public void setConnected(boolean connected)
throws IPWorksSSLException
Setting the Connected property to True makes the bean attempt
to connect to the host identified by the RemoteHost property.
If successful, after the connection is achieved the value of the
property changes to True and the Connected event is fired.
Setting Connected to False closes the connection. How and when the
connection is closed is controlled by the Linger property.
IPWorksSSLException
public void setDataToSend(byte[] dataToSend)
throws IPWorksSSLException
Assigning a string to the DataToSend property makes the bean send
the string to the remote host. The Send method provides similar functionality.
If you are sending data to the remote host faster than it can
process it, or faster than the network's bandwidth allows, the outgoing
queue might fill up. When this happens, DataToSend fails with exception 10035: "[10035] Operation would block" (WSAEWOULDBLOCK).
You can check this error, and then try to send the data again.
The BytesSent property shows how many bytes were sent
(if any). If 0 bytes were sent, then you
can wait for the ReadyToSend event before attempting to send data
again. (However, please note that ReadyToSend is not fired when part
of the data is successfully sent).
IPWorksSSLExceptionpublic byte[] getEOL()
The EOL property is used to define boundaries in the input
stream using the value of the property.
The EOL property is especially useful with ASCII files. Setting it to
CRLF ("\\r\\n")
enables splitting of the incoming ASCII text
stream into lines. In this case, one event is fired for each line
received (as well as in packet boundaries).
The CRLF ("\\r\\n")
bytes are discarded.
The EOL property is a binary string. In particular, this means
that it can be more than one byte long, and it can contain NULL bytes.
public void setEOL(byte[] EOL)
throws IPWorksSSLException
The EOL property is used to define boundaries in the input
stream using the value of the property.
The EOL property is especially useful with ASCII files. Setting it to
CRLF ("\\r\\n")
enables splitting of the incoming ASCII text
stream into lines. In this case, one event is fired for each line
received (as well as in packet boundaries).
The CRLF ("\\r\\n")
bytes are discarded.
The EOL property is a binary string. In particular, this means
that it can be more than one byte long, and it can contain NULL bytes.
IPWorksSSLExceptionpublic java.lang.String getFirewallHost()
If a FirewallHost is given, requested connections will be
authenticated through the specified firewall when connecting.
If the FirewallHost property is set to a Domain Name, a DNS request
is initiated. Upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the
search is not successful, an error is returned.
public void setFirewallHost(java.lang.String firewallHost)
throws IPWorksSSLException
If a FirewallHost is given, requested connections will be
authenticated through the specified firewall when connecting.
If the FirewallHost property is set to a Domain Name, a DNS request
is initiated. Upon successful termination of the request, the FirewallHost property is set to the corresponding address. If the
search is not successful, an error is returned.
IPWorksSSLExceptionpublic java.lang.String getFirewallPassword()
if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public void setFirewallPassword(java.lang.String firewallPassword)
throws IPWorksSSLException
if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
IPWorksSSLExceptionpublic int getFirewallPort()
The TCP port for the FirewallHost . See the
description of the FirewallHost property for
details.
Note that the FirewallPort is set automatically
when FirewallType is set to a valid value. See the
description of the FirewallType property for
details.
public void setFirewallPort(int firewallPort)
throws IPWorksSSLException
The TCP port for the FirewallHost . See the
description of the FirewallHost property for
details.
Note that the FirewallPort is set automatically
when FirewallType is set to a valid value. See the
description of the FirewallType property for
details.
IPWorksSSLExceptionpublic int getFirewallType()
The applicable values are the following:
FirewallPort is set to 80.
FirewallPort is set to 1080.
FirewallPort is set to 1080.
public void setFirewallType(int firewallType)
throws IPWorksSSLException
The applicable values are the following:
FirewallPort is set to 80.
FirewallPort is set to 1080.
FirewallPort is set to 1080.
IPWorksSSLExceptionpublic java.lang.String getFirewallUser()
if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
public void setFirewallUser(java.lang.String firewallUser)
throws IPWorksSSLException
if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate
to the given firewall. If the authentication fails, a trappable error is fired.
IPWorksSSLExceptionpublic boolean isKeepAlive()
The KeepAlive enables the SO_KEEPALIVE option on the socket.
This option prevents long connections from timing out in case
of inactivity.
Please note that system TCP/IP stack implementations are not required to support SO_KEEPALIVE.
public void setKeepAlive(boolean keepAlive)
throws IPWorksSSLException
The KeepAlive enables the SO_KEEPALIVE option on the socket.
This option prevents long connections from timing out in case
of inactivity.
Please note that system TCP/IP stack implementations are not required to support SO_KEEPALIVE.
IPWorksSSLExceptionpublic boolean isLinger()
The Linger property controls how a connection is closed. The default is True.
In this case the connection is closed only after all the data is sent.
Setting it to False forces an abrupt (hard) disconnection. Any
data that were in the sending queue may be lost.
The default behavior (which is also the default mode for some Winsock stream sockets) might result in an indefinite delay in closing the connection. Although the bean returns control immediately, the system might indefinitely hold system resources until all pending data are sent (even after your application closes). This means that valuable system resources might be wasted.
Setting Linger to False forces an immediate disconnection. If you
know that the other side has received all the data you had sent (by
a client acknowledgment, for example), setting Linger to False might
be the appropriate course of action.
public void setLinger(boolean linger)
throws IPWorksSSLException
The Linger property controls how a connection is closed. The default is True.
In this case the connection is closed only after all the data is sent.
Setting it to False forces an abrupt (hard) disconnection. Any
data that were in the sending queue may be lost.
The default behavior (which is also the default mode for some Winsock stream sockets) might result in an indefinite delay in closing the connection. Although the bean returns control immediately, the system might indefinitely hold system resources until all pending data are sent (even after your application closes). This means that valuable system resources might be wasted.
Setting Linger to False forces an immediate disconnection. If you
know that the other side has received all the data you had sent (by
a client acknowledgment, for example), setting Linger to False might
be the appropriate course of action.
IPWorksSSLExceptionpublic java.lang.String getLocalHost()
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean is connected, the LocalHost property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost)
throws IPWorksSSLException
The LocalHost property contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.
If the bean is connected, the LocalHost property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost is not persistent. You must always set it in
code, and never in the property window.
IPWorksSSLExceptionpublic int getLocalPort()
The LocalPort property must be set before a connection is
attempted. It instructs the bean to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the system to choose a port
at random. The chosen port will be shown by the LocalPort property after the connection is established.
LocalPort cannot be changed once a connection is made.
Any attempt to set the LocalPort property when a connection
is active will generate an error.
The LocalPort property is useful when trying to connect
to services that require a trusted port in the client side.
An example is the remote shell (rsh) service in UNIX systems.
public void setLocalPort(int localPort)
throws IPWorksSSLException
The LocalPort property must be set before a connection is
attempted. It instructs the bean to bind to a specific
port (or communication endpoint) in the local machine.
Setting it to 0 (default) enables the system to choose a port
at random. The chosen port will be shown by the LocalPort property after the connection is established.
LocalPort cannot be changed once a connection is made.
Any attempt to set the LocalPort property when a connection
is active will generate an error.
The LocalPort property is useful when trying to connect
to services that require a trusted port in the client side.
An example is the remote shell (rsh) service in UNIX systems.
IPWorksSSLExceptionpublic java.lang.String getRemoteHost()
The RemoteHost property specifies the IP address (IP number in
dotted internet format) or Domain Name of the remote host.
It is set before a connection is attempted and cannot be changed
once a connection is established.
If the RemoteHost property is set to a Domain Name, a DNS request
is initiated, and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the
search is not successful, an error is returned.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
Example (Connecting)
IPPortControl.RemoteHost = "MyHostNameOrIP"
IPPortControl.RemotePort = 777
IPPortControl.Connected = true
public void setRemoteHost(java.lang.String remoteHost)
throws IPWorksSSLException
The RemoteHost property specifies the IP address (IP number in
dotted internet format) or Domain Name of the remote host.
It is set before a connection is attempted and cannot be changed
once a connection is established.
If the RemoteHost property is set to a Domain Name, a DNS request
is initiated, and upon successful termination of the request, the RemoteHost property is set to the corresponding address. If the
search is not successful, an error is returned.
If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.
Example (Connecting)
IPPortControl.RemoteHost = "MyHostNameOrIP"
IPPortControl.RemotePort = 777
IPPortControl.Connected = true
IPWorksSSLExceptionpublic int getRemotePort()
The RemotePort property specifies a service port on the
remote host to connect to.
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
public void setRemotePort(int remotePort)
throws IPWorksSSLException
The RemotePort property specifies a service port on the
remote host to connect to.
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
IPWorksSSLExceptionpublic boolean isSingleLineMode()
When SingleLineMode is True, the bean treats the incoming
data stream as lines separated by CRLF, CR, or LF. The EOL property is ignored.
AcceptData will be automatically set to False when SingleLineMode is set to True. Please refer to the GetLine method for more information.
public void setSingleLineMode(boolean singleLineMode)
throws IPWorksSSLException
When SingleLineMode is True, the bean treats the incoming
data stream as lines separated by CRLF, CR, or LF. The EOL property is ignored.
AcceptData will be automatically set to False when SingleLineMode is set to True. Please refer to the GetLine method for more information.
IPWorksSSLExceptionpublic byte[] getSSLAcceptServerCert()
If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.
You may override this behavior by supplying a value for SSLAcceptServerCert .
If the certificate supplied in SSLAcceptServerCert is the same as the
certificate presented by the server, then the server
certificate is accepted unconditionally, and the connection will continue
normally.
Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, these property will create a security breach. Use it at your own risk.
public void setSSLAcceptServerCert(byte[] SSLAcceptServerCert)
throws IPWorksSSLException
If it finds any issues with the certificate presented by the server, the bean will normally terminate the connection with an error.
You may override this behavior by supplying a value for SSLAcceptServerCert .
If the certificate supplied in SSLAcceptServerCert is the same as the
certificate presented by the server, then the server
certificate is accepted unconditionally, and the connection will continue
normally.
Please note that this functionality is provided only for cases where you otherwise know that you are communicating with the right server. If used improperly, these property will create a security breach. Use it at your own risk.
IPWorksSSLExceptionpublic byte[] getSSLCertEncoded()
This property is used to assign a specific certificate for
SSL client authentication (SSL server authentication in
the case of the IPDaemonS bean).
The SSLCertStore and SSLCertSubject properties may also be used to specify a certificate.
When SSLCertEncoded is set, a search is initiated in the current SSLCertStore for the private key of the certificate. If the key
is found, SSLCertSubject is updated to reflect the full subject
of the selected certificate, otherwise SSLCertSubject is set
to empty string.
public void setSSLCertEncoded(byte[] SSLCertEncoded)
throws IPWorksSSLException
This property is used to assign a specific certificate for
SSL client authentication (SSL server authentication in
the case of the IPDaemonS bean).
The SSLCertStore and SSLCertSubject properties may also be used to specify a certificate.
When SSLCertEncoded is set, a search is initiated in the current SSLCertStore for the private key of the certificate. If the key
is found, SSLCertSubject is updated to reflect the full subject
of the selected certificate, otherwise SSLCertSubject is set
to empty string.
IPWorksSSLExceptionpublic byte[] getSSLCertStore()
The SSLCertStoreType property specifies the type of the
certificate store specified by SSLCertStore . If the store
is password protected, specify the password in SSLCertStorePassword .
SSLCertStore is used in conjunction with the SSLCertSubject property in order to specify client certificates. If SSLCertStore has a value, and SSLCertSubject or SSLCertEncoded is set, a search for a certificate is initiated. Please refer to the SSLCertSubject property for details.
Designations of certificate stores are platform-dependent.
The following are designations of the most common User and Machine certificate stores in Windows:
In Java, the certificate store normally is a file containing certificates and optional private keys.
When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).
If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.
public void setSSLCertStore(byte[] SSLCertStore)
throws IPWorksSSLException
The SSLCertStoreType property specifies the type of the
certificate store specified by SSLCertStore . If the store
is password protected, specify the password in SSLCertStorePassword .
SSLCertStore is used in conjunction with the SSLCertSubject property in order to specify client certificates. If SSLCertStore has a value, and SSLCertSubject or SSLCertEncoded is set, a search for a certificate is initiated. Please refer to the SSLCertSubject property for details.
Designations of certificate stores are platform-dependent.
The following are designations of the most common User and Machine certificate stores in Windows:
In Java, the certificate store normally is a file containing certificates and optional private keys.
When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).
If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.
IPWorksSSLExceptionpublic java.lang.String getSSLCertStorePassword()
If the certificate store is of a type that requires a password, the value of this property is used to open the certificate store.
public void setSSLCertStorePassword(java.lang.String SSLCertStorePassword)
throws IPWorksSSLException
If the certificate store is of a type that requires a password, the value of this property is used to open the certificate store.
IPWorksSSLExceptionpublic int getSSLCertStoreType()
This property can take one of the following values:
public void setSSLCertStoreType(int SSLCertStoreType)
throws IPWorksSSLException
This property can take one of the following values:
IPWorksSSLExceptionpublic java.lang.String getSSLCertSubject()
When this property is set, a search is performed in the current certificate store certificate with matching subject.
If an exact match is not found, the store is searched for subjects containing the value of the property.
When setting the property to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US
Example (Searching with partial subject)
Control.CertSubject = "Test"
If a match is not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
If a matching certificate is found, the SSLCertSubject property
is set to the full subject of the matching certificate.
public void setSSLCertSubject(java.lang.String SSLCertSubject)
throws IPWorksSSLException
When this property is set, a search is performed in the current certificate store certificate with matching subject.
If an exact match is not found, the store is searched for subjects containing the value of the property.
When setting the property to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US
Example (Searching with partial subject)
Control.CertSubject = "Test"
If a match is not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
If a matching certificate is found, the SSLCertSubject property
is set to the full subject of the matching certificate.
IPWorksSSLExceptionpublic byte[] getSSLServerCert()
SSLServerCert contains the server certificate for the
last established connection.
SSLServerCert is reset every time a new connection is attempted.
public java.lang.String getSSLServerCertStatus()
When the verification fails, SSLServerCertStatus contains
a string that indicates the reason(s) why, otherwise, it
contains the string "OK".
Please note that the value of SSLServerCertStatus must
be considered as only a suggestion as to the validity of the
certificate. Application software must use its own logic
to determine whether to accept the certificate or not, by using
the SSLServerCert to access other certificate
properties, or other application-specific information.
SSLServerCertStatus is reset an empty string every time a new
connection is attempted.
public int getSSLStartMode()
The SSLStartMode property may have one of the following values:
SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit
( sslImplicit ).
public void setSSLStartMode(int SSLStartMode)
throws IPWorksSSLException
The SSLStartMode property may have one of the following values:
SSLStartMode is set to sslExplicit . In all other cases, SSL negotiation will be implicit
( sslImplicit ).
IPWorksSSLExceptionpublic int getTimeout()
If the Timeout property is set to 0, all operations return
immediately, potentially failing with an 'WOULDBLOCK' error if data can't be sent or received immediately.
If Timeout is set to a positive value, the bean will
automatically retry each operation that would otherwise result in a 'WOULDBLOCK' error for a maximum of Timeout seconds.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 0 (asynchronous
operation).
public void setTimeout(int timeout)
throws IPWorksSSLException
If the Timeout property is set to 0, all operations return
immediately, potentially failing with an 'WOULDBLOCK' error if data can't be sent or received immediately.
If Timeout is set to a positive value, the bean will
automatically retry each operation that would otherwise result in a 'WOULDBLOCK' error for a maximum of Timeout seconds.
The bean will use DoEvents to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and remains responsive.
If Timeout expires, and the operation is not yet complete,
the bean throws an IPWorksException
raises an IPWorksException exception
.
Please note that by default, all timeouts are inactivity timeouts ,
i.e. the timeout period is extended by Timeout seconds when
data is successfully sent or received.
Optionally, the behavior of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum
of Timeout seconds since the beginning of the operation, without
extending the timeout period during communications.
This behavior is controlled by theAbsoluteTimeoutconfiguration setting.
The default value for the Timeout property is 0 (asynchronous
operation).
IPWorksSSLException
public java.lang.String config(java.lang.String configurationString)
throws IPWorksSSLException
Config is a generic method available in every bean.
It is used to set and retrieveconfiguration settingsfor the
bean.
Configuration settings are similar in functionality to properties,
but they are rarely used. In order to avoid "polluting" the property
namespace of the bean, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.
IPWorksSSLException
public void connect(java.lang.String host,
int port)
throws IPWorksSSLException
Calling this method is equivalent to setting the RemoteHost property
to Host , setting RemotePort to Port , and then setting
the Connected property to True.
Example (Connecting)
IPPortControl.Connect("MyHostNameOrIP", 777)
IPWorksSSLException
public void disconnect()
throws IPWorksSSLException
Calling this method is equivalent to setting the Connected property
to False.
IPWorksSSLException
public void doEvents()
throws IPWorksSSLException
When DoEvents is called, the bean processes any
available events. If no events are available, it waits for a
preset period of time, and then returns.
IPWorksSSLException
public java.lang.String getLine()
throws IPWorksSSLException
This method is an alternative method of receiving data for line-oriented protocols.
The bean will block if necessary and then return the received line. AcceptData will be automatically set to True when the method is called, and then back to False
after a line is received.
Please refer to the SingleLineMode property for more information.
IPWorksSSLException
public void send(byte[] text)
throws IPWorksSSLException
Calling this method is equivalent to setting the DataToSend property
to Text .
IPWorksSSLException
public void sendLine(java.lang.String text)
throws IPWorksSSLException
This method is used for sending data with line-oriented protocols. The line is followed by CRLF ("\\r\\n") .
Please refer to the GetLine method and SingleLineMode property
for more information.
IPWorksSSLException
public void startSSL()
throws IPWorksSSLException
This method is used to start SSL negotiation on a plaintext connection.
Please refer to the SSLStartMode property for more information.
Note that the Connected event will fire again after SSL negotiation
is complete.
IPWorksSSLException
public void addIpportsEventListener(IpportsEventListener l)
throws java.util.TooManyListenersException
java.util.TooManyListenersExceptionpublic void removeIpportsEventListener(IpportsEventListener l)
|
IP*Works! SSL V6 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||