|
Yate
|
An abstract cipher. More...
#include <yateclass.h>
Public Types | |
| enum | Direction { Bidir, Encrypt, Decrypt } |
Public Member Functions | |
| virtual | ~Cipher () |
| virtual void * | getObject (const String &name) const |
| virtual bool | valid (Direction dir=Bidir) const |
| virtual unsigned int | blockSize () const =0 |
| virtual unsigned int | initVectorSize () const |
| unsigned int | bufferSize (unsigned int len) const |
| bool | bufferFull (unsigned int len) const |
| virtual bool | setKey (const void *key, unsigned int len, Direction dir=Bidir)=0 |
| bool | setKey (const DataBlock &key, Direction dir=Bidir) |
| virtual bool | initVector (const void *vect, unsigned int len, Direction dir=Bidir) |
| bool | initVector (const DataBlock &vect, Direction dir=Bidir) |
| virtual bool | encrypt (void *outData, unsigned int len, const void *inpData=0)=0 |
| bool | encrypt (DataBlock &data) |
| virtual bool | decrypt (void *outData, unsigned int len, const void *inpData=0)=0 |
| bool | decrypt (DataBlock &data) |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | toString () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static const TokenDict * | directions () |
| static Direction | direction (const char *name, Direction defdir=Bidir) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
An abstract cipher.
The Cipher class provides an abstraction for data encryption classes
|
virtual |
Destructor
|
pure virtual |
Get the cipher block size
| bool bufferFull | ( | unsigned int | len | ) | const |
Check if a buffer length is multiple of block size
| len | Length of data to encrypt or decrypt in bytes |
| unsigned int bufferSize | ( | unsigned int | len | ) | const |
Round up a buffer length to a multiple of block size
| len | Length of data to encrypt or decrypt in bytes |
|
pure virtual |
Decrypt data
| outData | Pointer to buffer for output (decrypted) and possibly input data |
| len | Length of output data, may not be multiple of block size |
| inpData | Pointer to buffer containing input (encrypted) data, NULL to decrypt in place |
Referenced by Cipher::decrypt().
|
inline |
Decrypt a DataBlock in place
| data | Data block to decrypt |
References DataBlock::data(), Cipher::decrypt(), and DataBlock::length().
Get a direction from the dictionary given the name
| name | Name of the direction |
| defdir | Default direction to return if name is empty or unknown |
References TelEngine::lookup().
|
inlinestatic |
Get the dictionary of cipher directions
|
pure virtual |
Encrypt data
| outData | Pointer to buffer for output (encrypted) and possibly input data |
| len | Length of output data, may not be multiple of block size |
| inpData | Pointer to buffer containing input (unencrypted) data, NULL to encrypt in place |
Referenced by Cipher::encrypt().
|
inline |
Encrypt a DataBlock in place
| data | Data block to encrypt |
References DataBlock::data(), Cipher::encrypt(), and DataBlock::length().
|
virtual |
Get a pointer to a derived class given that class name
| name | Name of the class we are asking for |
Reimplemented from GenObject.
|
virtual |
Set the Initialization Vector if applicable
| vect | Pointer to binary Initialization Vector data |
| len | Length of Initialization Vector in bytes |
| dir | Direction to set the Initialization Vector for |
Referenced by Cipher::initVector().
Set the Initialization Vector is applicable
| vect | Binary Initialization Vector |
| dir | Direction to set the Initialization Vector for |
References DataBlock::data(), Cipher::initVector(), and DataBlock::length().
|
virtual |
Get the initialization vector size
|
pure virtual |
Set the key required to encrypt or decrypt data
| key | Pointer to binary key data |
| len | Length of key in bytes |
| dir | Direction to set key for |
Referenced by Cipher::setKey().
Set the key required to encrypt or decrypt data
| key | Binary key data block |
| dir | Direction to set key for |
References DataBlock::data(), DataBlock::length(), and Cipher::setKey().
|
virtual |
Check if the cipher instance is valid for a specific direction
| dir | Direction to check |
1.8.8