# DataBlockEncryptor Class Reference

`#include <DataBlockEncryptor.h>`

List of all members.

## Public Member Functions

| DataBlockEncryptor ()
| ~DataBlockEncryptor ()
bool | IsKeySet (void) const
void | SetKey (const unsigned char key[16])
void | UnsetKey (void)
void | Encrypt (unsigned char *input, int inputLength, unsigned char *output, int *outputLength)
bool | Decrypt (unsigned char *input, int inputLength, unsigned char *output, int *outputLength)

## Protected Attributes

AES128 | secretKeyAES128
bool | keySet

## Detailed Description

Encrypt and Decrypt block of data

## Constructor & Destructor Documentation

DataBlockEncryptor::DataBlockEncryptor | ( |  | ) |

| Default Constructor

DataBlockEncryptor::~DataBlockEncryptor | ( |  | ) |

| Destructor

## Member Function Documentation

bool DataBlockEncryptor::Decrypt | ( | unsigned char * | input,
|  | int | inputLength,
|  | unsigned char * | output,
|  | int * | outputLength
| ) |

Decrypt removes bytes, as few as 6. Output should be large enough to hold this. Output can be the same memory block as input

Parameters:

  | input | the input buffer to decrypt
  | inputLength | the size of the input buffer
  | output | the output buffer to store decrypted data
  | outputLength | the size of the output buffer

Returns:
  False on bad checksum or input, true on success

void DataBlockEncryptor::Encrypt | ( | unsigned char * | input,
|  | int | inputLength,
|  | unsigned char * | output,
|  | int * | outputLength
| ) |

Encrypt adds up to 15 bytes. Output should be large enough to hold this. Output can be the same memory block as input

Parameters:

  | input | the input buffer to encrypt
  | inputLength | the size of the input buffer
  | output | the output buffer to store encrypted data
  | outputLength | the size of the output buffer

bool DataBlockEncryptor::IsKeySet | ( | void |  | ) | const

Test if encryption/decryption key are set

Returns:
  true if SetKey has been called previously

void DataBlockEncryptor::SetKey | ( | const unsigned char | key[16] | ) |

Set the encryption key

Parameters:

  | key | The new encryption key

void DataBlockEncryptor::UnsetKey | ( | void |  | ) |

| Unset the encryption key

## Member Data Documentation

bool DataBlockEncryptor::keySet`[protected]`

| True if a key is set

AES128 DataBlockEncryptor::secretKeyAES128`[protected]`

| The encryption / decryption key

The documentation for this class was generated from the following files:

- Projects/raknet/include/raknet/DataBlockEncryptor.h
- Projects/raknet/Source/DataBlockEncryptor.cpp