Skip to main content

ERUCES::TEAgent

#include <teagent.h>

The TEAgent class represents the Key Service Agent and forms the base class of the TEAgentMatrix and TEAgentFile classes.

Inheritance

Protected Attributes

TypeNameDescription
boolm_bEncode
boolm_bDecode
boolm_bAlloc
void *m_matrix
void *m_pConn
void *m_pCProv
void *m_pHash
void *m_pTEConn
void *m_pCipher

Public Member Functions

MemberDescription
TEAgent()The TEAgent constructor is the default class constructor.
~TEAgent()The TEAgent destructor is the class destructor.
void setEncodeMode(bool encode)The setEncodeMode method sets the encode mode, which determines whether the output data will be Base64 encoded.
bool getEncodeMode()The getEncodeMode method gets the encode mode currently in use.
void setDecodeMode(bool decode)The setDecodeMode method sets the decode mode, which indicates whether the input data will be Base64 decoded.
bool getDecodeMode()The getDecodeMode method gets the decode mode currently in use.
void setCipher(TECipher *cipher)The setCipher method sets the cipher object. All encryption and decryption will be performed inside agent.
const TECipher * getCipher() constThe getCipher gets the cipher object.
void attachConnection(uint32_t handle)The attachConnection method attaches to a connection specified by a connection handle.
void attachConnection(const TEConnection *conn)The attachConnection method attaches to a connection specified by a TEConnection pointer.
uint32_t detachConnection()The detachConnection method detaches a connection.
void encrypt()The encrypt method encrypts data.
void decrypt()The decrypt method decrypts data.
void encryptData(_TESTD string &data, _TESTD string &hl, const _TESTD string &iv)The encryptData method encrypts data using a specified TTag and IV.
void decryptData(_TESTD string &data, const _TESTD string &hl, const _TESTD string &iv)The decryptData method decrypts data using a specified TTag and initialization vector.
void decryptData(_TESTD string &data, const _TESTD string &hl, uint32_t less)The decryptData method decrypts data using a specified TTag and initialization vector.
uint32_t performHash(_TESTD vector< _TESTD pair< _TESTD string, _TESTD string > > &data) constThe performHash method hashes data.
void clear()The clear method clears all internal status data.
void reset()The reset method clears all internal status data and detaches the connection.
_TESTD auto_ptr< TEAgent > clone() constThe clone method clones a TEAgent object.

Protected Member Functions

MemberDescription
void processData(long fid, char id, _TESTD string &data, _TESTD string &hl, const _TESTD string &iv, bool bHLDecode=false, bool bHLEncode=false)The processData method processes data (for internal use only).

Member Function Documentation

TEAgent()

The TEAgent constructor is the default class constructor.

~TEAgent()

The TEAgent destructor is the class destructor.

void setEncodeMode(bool encode)

The setEncodeMode method sets the encode mode, which determines whether the output data will be Base64 encoded.

Parameters

ParameterDescription
encodeA boolean value indicating whether the output data will be Base64 encoded; True = output will be Base64 encoded, False = output will not be Base64 encoded.

bool getEncodeMode()

The getEncodeMode method gets the encode mode currently in use.

Returns: Returns a boolean value representing whether the Base64 encoding is in use; True = Base64 encoding is in use, False = Base64 encoding is not in use.

void setDecodeMode(bool decode)

The setDecodeMode method sets the decode mode, which indicates whether the input data will be Base64 decoded.

Parameters

ParameterDescription
decodeA boolean value indicating whether the input data will be Base64 decoded; True = input will be Base64 decoded, False = input will not be Base64 decoded.

bool getDecodeMode()

The getDecodeMode method gets the decode mode currently in use.

Returns: Returns a boolean value representing whether Base64 decoding is in use; True = Base64 decoding is in use, False = Base64 decoding is not in use.

void setCipher(TECipher *cipher)

The setCipher method sets the cipher object. All encryption and decryption will be performed inside agent.

Parameters

ParameterDescription
cipherCipher object

const TECipher * getCipher() const

The getCipher gets the cipher object.

Returns: Returns a pointer to cipher object

void attachConnection(uint32_t handle)

The attachConnection method attaches to a connection specified by a connection handle.

Parameters

ParameterDescription
handleA 32-bit unsigned integer representing a connection handle for an existing connection.

void attachConnection(const TEConnection *conn)

The attachConnection method attaches to a connection specified by a TEConnection pointer.

Parameters

ParameterDescription
connA constant pointer to an existing TEConnection object.

uint32_t detachConnection()

The detachConnection method detaches a connection.

Returns: Returns an unsigned 32-bit integer representing the connection handle of the detached connection.

void encrypt()

The encrypt method encrypts data.

void decrypt()

The decrypt method decrypts data.

void encryptData(_TESTD string &data, _TESTD string &hl, const _TESTD string &iv)

The encryptData method encrypts data using a specified TTag and IV.

Parameters

ParameterDescription
dataA string of data; input is to be encrypted, output has been encrypted.
hlA constant string representing a TTag to be used for encryption.
ivA constant string representing an IV to be used for encryption.

void decryptData(_TESTD string &data, const _TESTD string &hl, const _TESTD string &iv)

The decryptData method decrypts data using a specified TTag and initialization vector.

Parameters

ParameterDescription
dataA string of data; input is to be decrypted, output has been decrypted.
hlA constant string representing a TTag to be used for decryption.
ivA constant string representing an IV to be used for decryption.

void decryptData(_TESTD string &data, const _TESTD string &hl, uint32_t less)

The decryptData method decrypts data using a specified TTag and initialization vector.

Parameters

ParameterDescription
dataA string of data; input is to be decrypted, output has been decrypted.
hlA constant string representing a TTag to be used for decryption.
lessAn integer representing .

uint32_t performHash(_TESTD vector< _TESTD pair< _TESTD string, _TESTD string > > &data) const

The performHash method hashes data.

The hash method is SHA -

Parameters

ParameterDescription
dataA vector of string pairs. Input: First string is data to be hashed, second string is salt to be used; Output: First string is hashed value, second string is unchanged.

Returns: Return value represents the size of a vector.

void clear()

The clear method clears all internal status data.

void reset()

The reset method clears all internal status data and detaches the connection.

_TESTD auto_ptr< TEAgent > clone() const

The clone method clones a TEAgent object.

Returns: Returns a smart pointer to a new TEAgent object.

void processData(long fid, char id, _TESTD string &data, _TESTD string &hl, const _TESTD string &iv, bool bHLDecode=false, bool bHLEncode=false)

The processData method processes data (for internal use only).

Parameters

ParameterDescription
fidFunction ID
idoperation ID
dataString of data to be processed
hlA string representing the TTag
ivString of IV
bHLDecodeDecoding TTag for input
bHLEncodeEncoding TTag for output