Skip to main content

tech.pisoft.teagent.TEAgentConnection

The TEAgentConnection class opens a pure connection to a Key Service.

Since: 1.0

© Pi Soft, 2018-2026 · Tricryption Engine 8.1

Inheritance​

Static Public Attributes​

TypeNameDescription
final intERR_CLIENT_BUILD_NOT_ADMITTEDThe Key Service's error code for a connection whose client build is not admitted at the code-signing level in force: ERR_CLIENT_BUILD_NOT_ADMITTED, 0x0301.

Public Member Functions​

MemberDescription
TEAgentConnection()The TEAgentConnection constructor constructs a non-connected object.
TEAgentConnection(String strServerName, int nPort)The TEAgentConnection constructor constructs a connected object.
byte[] getChannelBinding()The getChannelBinding method returns this connection's RFC 9266 channel binding: the 32-byte TLS exporter under the label EXPORTER-Channel-Binding with no context, the value the Key Service computes for the same connection.
boolean isConnected()The isConnected method checks whether a socket is currently connected.
int compareTo(Object o)The compareTo method compares an object.
synchronized void open(String strServerName, int nPort, String strUserName, String strPasswd)The open method opens a connection to a Key Service and authenticates a user.
synchronized void open(String strServerName, int nPort, AuthenticationContext ctx)The open method opens a connection to a Key Service.
synchronized void close()The close method closes a connection.
synchronized void encrypt(TEAgent agent)The encrypt method encrypts data.
synchronized void decrypt(TEAgent agent)The decrypt method decrypts data.
void setTimeout(int nTimeout)The setTimeout method sets the length of a session before timeout.
int getTimeout()The getTimeout method gets the duration of a session before a timeout.
long getLoginID()The getLoginID method gets the principal ID of the currently logged in user.

Member Function Documentation​

TEAgentConnection()​

The TEAgentConnection constructor constructs a non-connected object.

TEAgentConnection(String strServerName, int nPort)​

The TEAgentConnection constructor constructs a connected object.

Parameters

ParameterDescription
strServerNameA string representing the name of a Key Server.
nPortAn integer representing a Key Service port number.

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException).

byte[] getChannelBinding()​

The getChannelBinding method returns this connection's RFC 9266 channel binding: the 32-byte TLS exporter under the label EXPORTER-Channel-Binding with no context, the value the Key Service computes for the same connection.

The socket the SSL connections attach (TEAgentSSLAuthenticConnection, TEAgentSSLMConnection) is an javax.net.ssl.SSLSocket; the exporter is read from its javax.net.ssl.ExtendedSSLSession through exportKeyingMaterialData("EXPORTER-Channel-Binding", null, 32) (JDK 25). Refused, each by name, when the connection is not open, when the socket is a plain socket (no TLS – the base listener), when the socket is not connected, when the TLS handshake has not completed (the session is invalid, or the protocol is not TLS 1.3), and when the JSSE session is not an ExtendedSSLSession. Asked on a connected socket whose first exchange has not yet run, getSession() completes the handshake first – that is the JSSE contract – so the value returned is always this connection's own.

The value is a SECRET of the connection: a party that learned the Key Service's copy could satisfy a channel-binding check without holding the channel. Never log it, never put it on the wire; the AM08 exchange carries only its SHA-256 (see X509Context.channelBoundMessage, package-private).

Exceptions

ExceptionDescription
TEAgentExceptionnaming the refusal.

Returns: the 32 exporter bytes.

boolean isConnected()​

The isConnected method checks whether a socket is currently connected.

Returns: Returns a boolean value representing the socket connection status; True = connected, False = not connected. This function is valid only in V1.4. It will return a value of True for all previous versions.

int compareTo(Object o)​

The compareTo method compares an object.

Parameters

ParameterDescription
oAn object to compare to

Remark: Specified by the compareTo method in java.util.Comparable.

synchronized void open(String strServerName, int nPort, String strUserName, String strPasswd)​

The open method opens a connection to a Key Service and authenticates a user.

Parameters

ParameterDescription
strServerNameA string representing the name of a Key Server or IP
nPortAn integer representing a the port of the Key Service.
strUserNameA string representing a user's name.
strPasswdA string containing the user's password

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException).

synchronized void open(String strServerName, int nPort, AuthenticationContext ctx)​

The open method opens a connection to a Key Service.

Parameters

ParameterDescription
strServerNameA string representing the name of a Key Server or IP
nPortAn integer representing a the port of the Key Service.
ctxAn AuthenticationContext object.

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException); a TEServerException with code ERR_CLIENT_BUILD_NOT_ADMITTED when the client build is not admitted, after the connection is closed.

synchronized void close()​

The close method closes a connection.

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException).

synchronized void encrypt(TEAgent agent)​

The encrypt method encrypts data.

Parameters

ParameterDescription
agentA TEAgent object to be encrypted.

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException).

synchronized void decrypt(TEAgent agent)​

The decrypt method decrypts data.

Parameters

ParameterDescription
agentA TEAgent object to be decrypted

Exceptions

ExceptionDescription
TEAgentExceptionif the request cannot be completed on the connection, or the Key Service returns an error for it (delivered as a TEServerException).

void setTimeout(int nTimeout)​

The setTimeout method sets the length of a session before timeout.

Parameters

ParameterDescription
nTimeoutAn integer representing the length of a session, in milliseconds.

int getTimeout()​

The getTimeout method gets the duration of a session before a timeout.

Returns: Returns an integer representing the length of a session before a timeout, expressed in milliseconds.

long getLoginID()​

The getLoginID method gets the principal ID of the currently logged in user.

Returns: Returns an integer representing the principal ID of the user.