Encrypts and decrypts data blocks. More...
#include <DataBlockEncryptor.h>
Public Member Functions | |
DataBlockEncryptor () | |
~DataBlockEncryptor () | |
bool | IsKeySet (void) const |
void | SetKey (const unsigned char key[16]) |
Set the encryption key. | |
void | UnsetKey (void) |
Unset the encryption key. | |
void | Encrypt (unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength, RakNetRandom *rnr) |
Encryption adds 6 data bytes and then pads the number of bytes to be a multiple of 16. | |
bool | Decrypt (unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength) |
Decryption removes bytes, as few as 6. | |
Protected Attributes | |
keyInstance | keyEncrypt |
keyInstance | keyDecrypt |
cipherInstance | cipherInst |
bool | keySet |
Encrypts and decrypts data blocks.
Definition at line 18 of file DataBlockEncryptor.h.
DataBlockEncryptor::DataBlockEncryptor | ( | ) |
Definition at line 17 of file DataBlockEncryptor.cpp.
DataBlockEncryptor::~DataBlockEncryptor | ( | ) |
Definition at line 22 of file DataBlockEncryptor.cpp.
bool DataBlockEncryptor::Decrypt | ( | unsigned char * | input, | |
unsigned int | inputLength, | |||
unsigned char * | output, | |||
unsigned int * | outputLength | |||
) |
Decryption removes bytes, as few as 6.
Output should be large enough to hold this. Output can be the same memory block as input
[in] | input | the input buffer to decrypt |
[in] | inputLength | the size of the input buffer |
[in] | output | the output buffer to store decrypted data |
[in] | outputLength | the size of the output buffer |
Definition at line 127 of file DataBlockEncryptor.cpp.
void DataBlockEncryptor::Encrypt | ( | unsigned char * | input, | |
unsigned int | inputLength, | |||
unsigned char * | output, | |||
unsigned int * | outputLength, | |||
RakNetRandom * | rnr | |||
) |
Encryption adds 6 data bytes and then pads the number of bytes to be a multiple of 16.
Output should be large enough to hold this. Output can be the same memory block as input
[in] | input | the input buffer to encrypt |
[in] | inputLength | the size of the input buffer |
[in] | output | the output buffer to store encrypted data |
[in] | outputLength | the size of the output buffer |
Definition at line 44 of file DataBlockEncryptor.cpp.
bool DataBlockEncryptor::IsKeySet | ( | void | ) | const |
Definition at line 25 of file DataBlockEncryptor.cpp.
void DataBlockEncryptor::SetKey | ( | const unsigned char | key[16] | ) |
Set the encryption key.
[in] | key | The new encryption key |
Definition at line 30 of file DataBlockEncryptor.cpp.
void DataBlockEncryptor::UnsetKey | ( | void | ) |
Unset the encryption key.
Definition at line 39 of file DataBlockEncryptor.cpp.
cipherInstance DataBlockEncryptor::cipherInst [protected] |
Definition at line 62 of file DataBlockEncryptor.h.
keyInstance DataBlockEncryptor::keyDecrypt [protected] |
Definition at line 61 of file DataBlockEncryptor.h.
keyInstance DataBlockEncryptor::keyEncrypt [protected] |
Definition at line 60 of file DataBlockEncryptor.h.
bool DataBlockEncryptor::keySet [protected] |
Definition at line 63 of file DataBlockEncryptor.h.