Skip to main content

tech.pisoft.teagent.TEAgent

The TEAgent class is an abstract class containing the common cryptographic functions and the Key Service Agent settings.

Since: 1.0

© Pi Soft, 2018-2026 · Tricryption Engine 8.1

Inheritance​

Static Public Attributes​

TypeNameDescription
final shortENCRYPTIONThe ENCRYPTION field is a constant value for the operation type.
final shortDECRYPTIONThe DECRYPTION field is a constant value for the operation type.
final intHMAC_SHA384_LENThe length in bytes of an HMAC-SHA384 MAC.

Public Member Functions​

MemberDescription
TEAgent()The TEAgent constructor is the default constructor for the TEAgent class.
TEAgent(TEAgentConnection conn)The TEAgent constructor constructs a connection object with a connection.
abstract void encrypt()The encrypt method encrypts data.
abstract void decrypt()The decrypt method decrypts data.
synchronized byte[] performHMacSha384(byte[] data, byte[] hiddenLink)The performHMacSha384 method computes the keyed data hash: HMAC-SHA384 (RFC 2104 over SHA-384) of the data, computed by the Key Service under the raw bytes of the key the hidden link names; the key never leaves the Key Service.
synchronized byte[] encryptBuffer(byte[] szData, byte[][] szHL)The encryptBuffer method encrypts a buffer.
synchronized byte[] decryptBuffer(byte[] szData, byte[] szHL)The decryptBuffer method decrypts a buffer.
synchronized void reset()The reset method resets the status of a TEAgent object.

Static Public Member Functions​

MemberDescription
String performHash(String strData, String strSalt)The performHash method hashes data with SHA-256 (performHash v2).
byte[] performHash(byte[] byteData, byte[] byteSalt)The performHash method hashes data with SHA-256 (performHash v2).
byte[] performHMacSha384(TEAgentConnection conn, byte[] data, byte[] hiddenLink)The performHMacSha384 method computes the keyed data hash: HMAC-SHA384 (RFC 2104 over SHA-384) of the data, computed by the Key Service under the raw bytes of the key the hidden link names; the key never leaves the Key Service.
synchronized byte[] encryptBuffer(TEAgentConnection conn, byte[] szData, byte[][] szHL)The encryptBuffer method encrypts a buffer.
synchronized byte[] encryptBuffer(TEAgentConnection conn, byte[] szData, byte[][] szHL, byte[] szIV, boolean bHLEncoded)The encryptBuffer method encrypts a buffer.
synchronized byte[] decryptBuffer(TEAgentConnection conn, byte[] szData, byte[] szHL)The decryptBuffer method decrypts a buffer.
synchronized byte[] decryptBuffer(TEAgentConnection conn, byte[] szData, byte[] szHL, byte[] szIV, boolean bHLEncoded)The decryptBuffer method decrypts a buffer.
byte[] encryptBuffer(TECipher algorithm, byte[] data)The encryptBuffer method encrypts a buffer.
byte[] decryptBuffer(TECipher algorithm, byte[] data)The decryptBuffer method decrypts a buffer.

Member Function Documentation​

TEAgent()​

The TEAgent constructor is the default constructor for the TEAgent class.

TEAgent(TEAgentConnection conn)​

The TEAgent constructor constructs a connection object with a connection.

Parameters

ParameterDescription
connA TEAgentConnection object.

abstract void encrypt()​

The encrypt method encrypts data.

Exceptions

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

abstract void decrypt()​

The decrypt method decrypts data.

Exceptions

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

The performHMacSha384 method computes the keyed data hash: HMAC-SHA384 (RFC 2104 over SHA-384) of the data, computed by the Key Service under the raw bytes of the key the hidden link names; the key never leaves the Key Service.

Parameters

ParameterDescription
dataA byte array representing the data to be MACed (may be empty).
hiddenLinkA byte array representing the TTag of the key (raw, not Base64 encoded).

Exceptions

ExceptionDescription
TEAgentExceptionif the hidden link is empty (refused locally, before any request), the request cannot be completed on the connection, or the Key Service refuses it (a TEServerException: no such key, the key's ACL, or no role granting HMAC Data).

Returns: A byte array holding the 48-byte MAC.

synchronized byte[] encryptBuffer(byte[] szData, byte[][] szHL)​

The encryptBuffer method encrypts a buffer.

Parameters

ParameterDescription
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.

Exceptions

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

Returns: A byte array representing the encrypted data.

synchronized byte[] decryptBuffer(byte[] szData, byte[] szHL)​

The decryptBuffer method decrypts a buffer.

Parameters

ParameterDescription
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.

Exceptions

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

Returns: A byte array representing the decrypted buffer.

synchronized void reset()​

The reset method resets the status of a TEAgent object.

String performHash(String strData, String strSalt)​

The performHash method hashes data with SHA-256 (performHash v2).

v1 (SHA-1/MD5) outputs do not match v2 outputs; there is no compatibility mode. Note: performHash provides integrity/searchability, not strong pseudonymization of low-entropy data; for that, use a keyed construction (see the keyed-API roadmap note).

Parameters

ParameterDescription
strDataA string representing the data to be hashed.
strSaltA string representing the salt to be used for hashing.

Exceptions

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

Returns: A string representing the hashed data (Based 64 encoded).

byte[] performHash(byte[] byteData, byte[] byteSalt)​

The performHash method hashes data with SHA-256 (performHash v2).

v1 (SHA-1/MD5) outputs do not match v2 outputs; there is no compatibility mode. Note: performHash provides integrity/searchability, not strong pseudonymization of low-entropy data; for that, use a keyed construction (see the keyed-API roadmap note).

Parameters

ParameterDescription
byteDataA byte array representing the data to be hashed.
byteSaltA byte array representing the salt to be used for hashing.

Exceptions

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

Returns: A byte array representing the hashed data (unencoded).

The performHMacSha384 method computes the keyed data hash: HMAC-SHA384 (RFC 2104 over SHA-384) of the data, computed by the Key Service under the raw bytes of the key the hidden link names; the key never leaves the Key Service.

Parameters

ParameterDescription
connAn authenticated TEAgentConnection object.
dataA byte array representing the data to be MACed (may be empty).
hiddenLinkA byte array representing the TTag of the key (raw, not Base64 encoded).

Exceptions

ExceptionDescription
TEAgentExceptionif the hidden link is empty (refused locally, before any request), the request cannot be completed on the connection, or the Key Service refuses it (a TEServerException: no such key, the key's ACL, or no role granting HMAC Data).

Returns: A byte array holding the 48-byte MAC.

synchronized byte[] encryptBuffer(TEAgentConnection conn, byte[] szData, byte[][] szHL)​

The encryptBuffer method encrypts a buffer.

Parameters

ParameterDescription
connAn TEAgentConnection object.
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.

Exceptions

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

Returns: A byte array representing the encrypted data.

synchronized byte[] encryptBuffer(TEAgentConnection conn, byte[] szData, byte[][] szHL, byte[] szIV, boolean bHLEncoded)​

The encryptBuffer method encrypts a buffer.

Parameters

ParameterDescription
connAn TEAgentConnection object.
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.
szIVA byte array representing the IV.
bHLEncodedA boolean representing whether or not the data is Base64 encoded.

Exceptions

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

Returns: A byte array representing the encrypted data.

synchronized byte[] decryptBuffer(TEAgentConnection conn, byte[] szData, byte[] szHL)​

The decryptBuffer method decrypts a buffer.

Parameters

ParameterDescription
connAn TEAgentConnection object.
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.

Exceptions

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

Returns: A byte array representing the decrypted buffer.

synchronized byte[] decryptBuffer(TEAgentConnection conn, byte[] szData, byte[] szHL, byte[] szIV, boolean bHLEncoded)​

The decryptBuffer method decrypts a buffer.

Parameters

ParameterDescription
connAn TEAgentConnection object.
szDataA byte array representing data to be encrypted.
szHLA byte array representing a TTag.
szIVA byte array representing the IV.
bHLEncodedA boolean representing whether or not the data is Base64 encoded.

Exceptions

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

Returns: A byte array representing the decrypted buffer.

byte[] encryptBuffer(TECipher algorithm, byte[] data)​

The encryptBuffer method encrypts a buffer.

Parameters

ParameterDescription
algorithmThe encryption algorithm to use. AES_CBC_128, AES_CBC_192, AES_CBC_256
dataA byte array representing data 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).

Returns: Returns a string representing the encrypted data.

See also: TECipher, AES_CBC_128, AES_CBC_192, AES_CBC_256

byte[] decryptBuffer(TECipher algorithm, byte[] data)​

The decryptBuffer method decrypts a buffer.

Parameters

ParameterDescription
algorithmThe encryption algorithm to use. AES_CBC_128, AES_CBC_192, AES_CBC_256
dataA byte array representing data 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).

Returns: A byte array representing the decrypted buffer.

See also: TECipher, AES_CBC_128, AES_CBC_192, AES_CBC_256