Main Page Modules Namespaces C++ Classes Compound List File List Index
TNL: TNL::SymmetricCipher Class Reference

# TNL::SymmetricCipher Class Reference

`#include <tnlSymmetricCipher.h>`

Inheritance diagram for TNL::SymmetricCipher:

## Detailed Description

Class for symmetric encryption of data across a connection.

Internally it uses the libtomcrypt AES algorithm to encrypt the data.

## Public Types

enum | { BlockSize = 16, KeySize = 16 }

## Public Member Functions

| SymmetricCipher (const U8 symmetricKey[KeySize], const U8 initVector[BlockSize])
| SymmetricCipher (const ByteBuffer *theByteBuffer)
void | setupCounter (U32 counterValue1, U32 counterValue2, U32 counterValue3, U32 counterValue4)
void | encrypt (const U8 *plainText, U8 *cipherText, U32 len)
void | decrypt (const U8 *cipherText, U8 *plainText, U32 len)

## Private Attributes

U32 | mCounter [BlockSize >> 2]
U32 | mInitVector [BlockSize]
U8 | mPad [BlockSize]
Key | mSymmetricKey
U32 | mPadLen

## Data Structures

struct | Key

## Member Enumeration Documentation

anonymous enum

Enumerator:

  BlockSize |
  KeySize |

## Constructor & Destructor Documentation

TNL::SymmetricCipher::SymmetricCipher | ( | const U8 | symmetricKey[KeySize],
|  | const U8 | initVector[BlockSize] |
| ) |  |  |

TNL::SymmetricCipher::SymmetricCipher | ( | const ByteBuffer * | theByteBuffer | ) |

## Member Function Documentation

void TNL::SymmetricCipher::setupCounter | ( | U32 | counterValue1,
|  | U32 | counterValue2,
|  | U32 | counterValue3,
|  | U32 | counterValue4 |
| ) |  |  |

void TNL::SymmetricCipher::encrypt | ( | const U8 * | plainText,
|  | U8 * | cipherText,
|  | U32 | len |
| ) |  |  |

void TNL::SymmetricCipher::decrypt | ( | const U8 * | cipherText,
|  | U8 * | plainText,
|  | U32 | len |
| ) |  |  |

## Field Documentation

U32 TNL::SymmetricCipher::mCounter[BlockSize >> 2]`[private]`

U32 TNL::SymmetricCipher::mInitVector[BlockSize]`[private]`

U8 TNL::SymmetricCipher::mPad[BlockSize]`[private]`

Key TNL::SymmetricCipher::mSymmetricKey`[private]`

U32 TNL::SymmetricCipher::mPadLen`[private]`