News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

TNL::SymmetricCipher class Reference

TNL::SymmetricCipher Class Reference

#include <tnlSymmetricCipher.h>

Inheritance diagram for TNL::SymmetricCipher:

TNL::Object

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


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
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]