class Cipher

An abstract cipher. More...

Contains pure virtuals
Full nameTelEngine::Cipher
Definition#include <yateclass.h>
InheritsTelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods


Detailed Description

The Cipher class provides an abstraction for data encryption classes

enum Direction { Bidir, Encrypt, Decrypt, }

Direction

Cipher direction

inline const TokenDict*  directions ()

directions

[static]

Get the dictionary of cipher directions

Returns: Pointer to the dictionary of cipher directions

inline Direction  direction (const char* name, Direction defdir = Bidir)

direction

[static]

Get a direction from the dictionary given the name

Parameters:
nameName of the direction
defdirDefault direction to return if name is empty or unknown

Returns: Direction associated with the given name

 ~Cipher ()

~Cipher

[virtual]

Destructor

void*  getObject (const String& name)

getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:
nameName of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from GenObject.

bool  valid (Direction dir = Bidir)

valid

[const virtual]

Check if the cipher instance is valid for a specific direction

Parameters:
dirDirection to check

Returns: True if the cipher is able to perform operation on given direction

unsigned int  blockSize ()

blockSize

[const pure virtual]

Get the cipher block size

Returns: Cipher block size in bytes

unsigned int  initVectorSize ()

initVectorSize

[const virtual]

Get the initialization vector size

Returns: Initialization vector size in bytes, 0 if not applicable

unsigned int  bufferSize (unsigned int len)

bufferSize

[const]

Round up a buffer length to a multiple of block size

Parameters:
lenLength of data to encrypt or decrypt in bytes

Returns: Length of required buffer in bytes

bool  bufferFull (unsigned int len)

bufferFull

[const]

Check if a buffer length is multiple of block size

Parameters:
lenLength of data to encrypt or decrypt in bytes

Returns: True if buffer length is multiple of block size

bool  setKey (const void* key, unsigned int len, Direction dir = Bidir)

setKey

[pure virtual]

Set the key required to encrypt or decrypt data

Parameters:
keyPointer to binary key data
lenLength of key in bytes
dirDirection to set key for

Returns: True if the key was set successfully

inline bool  setKey (const DataBlock& key, Direction dir = Bidir)

setKey

Set the key required to encrypt or decrypt data

Parameters:
keyBinary key data block
dirDirection to set key for

Returns: True if the key was set successfully

bool  initVector (const void* vect, unsigned int len, Direction dir = Bidir)

initVector

[virtual]

Set the Initialization Vector if applicable

Parameters:
vectPointer to binary Initialization Vector data
lenLength of Initialization Vector in bytes
dirDirection to set the Initialization Vector for

Returns: True if the Initialization Vector was set successfully

inline bool  initVector (const DataBlock& vect, Direction dir = Bidir)

initVector

Set the Initialization Vector is applicable

Parameters:
vectBinary Initialization Vector
dirDirection to set the Initialization Vector for

Returns: True if the Initialization Vector was set successfully

bool  encrypt (void* outData, unsigned int len, const void* inpData = 0)

encrypt

[pure virtual]

Encrypt data

Parameters:
outDataPointer to buffer for output (encrypted) and possibly input data
lenLength of output data, may not be multiple of block size
inpDataPointer to buffer containing input (unencrypted) data, NULL to encrypt in place

Returns: True if data was successfully encrypted

inline bool  encrypt (DataBlock& data)

encrypt

Encrypt a DataBlock in place

Parameters:
dataData block to encrypt

Returns: True if data was successfully encrypted

bool  decrypt (void* outData, unsigned int len, const void* inpData = 0)

decrypt

[pure virtual]

Decrypt data

Parameters:
outDataPointer to buffer for output (decrypted) and possibly input data
lenLength of output data, may not be multiple of block size
inpDataPointer to buffer containing input (encrypted) data, NULL to decrypt in place

Returns: True if data was successfully decrypted

inline bool  decrypt (DataBlock& data)

decrypt

Decrypt a DataBlock in place

Parameters:
dataData block to decrypt

Returns: True if data was successfully decrypted


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.