- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# DataBlockEncryptor Class Reference

Encrypts and decrypts data blocks. More...

`#include <DataBlockEncryptor.h>`

List of all members.

## Public Member Functions
| DataBlockEncryptor ()
| Constructor.
| ~DataBlockEncryptor ()
| Destructor.
bool | IsKeySet (void) const
| Returns: true if SetKey has been called previously
void | SetKey (const unsigned char key[16])
void | UnsetKey (void)
| Unset the encryption key.
void | Encrypt (unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength)
bool | Decrypt (unsigned char *input, unsigned int inputLength, unsigned char *output, unsigned int *outputLength)

## Detailed Description

Encrypts and decrypts data blocks.

## Member Function Documentation

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

Set the encryption key

Parameters:

  `[in]` | key | The new encryption key

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

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

Parameters:

  `[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

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

Parameters:

  `[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

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

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

- C:/RakNet/Source/DataBlockEncryptor.h
- C:/RakNet/Source/DataBlockEncryptor.cpp