Photon Fusion 2.0.3

Public Member Functions | List of all members
DataEncryptor Class Reference

Responsible for encrypting and decrypting data buffers More...

Inherits IDataEncryption.

Public Member Functions

bool ComputeHash (byte *buffer, ref int bufferLength, int capacity)
 Compute the Buffer hash and append it to the buffer itself
 
bool DecryptData (byte *buffer, ref int bufferLength, int capacity)
 Decrypt data in place and update it's length.
 
void Dispose ()
 Dispose of the DataEncryptor More...
 
bool EncryptData (byte *buffer, ref int bufferLength, int capacity)
 Encrypts the data in the provided buffer. More...
 
byte[] GenerateKey ()
 Generate the key used used by the encryption implementation
 
void Setup (byte[] key)
 Setup the encryption implementation with the right key
 
bool VerifyHash (byte *buffer, ref int bufferLength, int capacity)
 Verify the buffer hash that was appended to the buffer
 

Detailed Description

Responsible for encrypting and decrypting data buffers

Member Function Documentation

◆ Dispose()

void Dispose ( )

Dispose of the DataEncryptor

◆ EncryptData()

bool EncryptData ( byte *  buffer,
ref int  bufferLength,
int  capacity 
)

Encrypts the data in the provided buffer.

Parameters
bufferThe buffer containing the data to be encrypted.
bufferLengthThe length of the data in the buffer.
capacityThe total capacity of the buffer.
Returns
Returns true if the encryption was successful, false otherwise.
Exceptions
InvalidOperationExceptionThrown when the encryption provider is not initialized.
ArgumentExceptionThrown when the original buffer cannot hold the encrypted data.

Implements IDataEncryption.