sipxportlib  Version 3.3
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | List of all members
OsEncryption Class Reference

Wrapper and helper around system encryption routines. More...

#include <OsEncryption.h>

Public Member Functions

 OsEncryption (void)
 Create one for each encryption/decryption operation. More...
 
virtual ~OsEncryption (void)
 
void setDataPointer (unsigned char *pIn, int inLen)
 Data to feed to encryption, not touched and NOT copied, so keep it around. More...
 
int getDataLen (void)
 How large is the untouched data buffer. More...
 
unsigned char * getDataPointer (void)
 Pointer to untouched data buffer. More...
 
void setResultsHeader (const unsigned char *header, int headerLen)
 If you want to prepend this to the results header for file identification purposes. More...
 
unsigned char * getResults (void)
 After [en/de]crypting, here's your results. More...
 
int getResultsLen (void)
 After [en/de]crypting get your results here. More...
 
void setKey (const unsigned char *key, int keyLen)
 set secret password More...
 
OsStatus decrypt (void)
 operate after setting approp. input. . NOTE: This will return OS_FAILED on vxworks. */ More...
 
OsStatus encrypt (void)
 operate after setting approp. input. NOTE: This will return OS_FAILED on vxworks. */ More...
 
OsStatus release (void)
 free all, called in descructor More...
 

Static Public Attributes

static UtlBoolean sIgnoreEncryption = FALSE
 DEBUG turn on/off. More...
 

Protected Types

enum  Direction { DECRYPT = 0, ENCRYPT = 1 }
 OpenSSL state differentation direction for API calls. More...
 

Protected Member Functions

OsStatus init (Direction direction)
 allocate OpenSSL stuff More...
 
UtlBoolean openSslError (void)
 common handling of OpenSSL's errors More...
 
OsStatus crypto (Direction direction)
 common [en/de]crypt method More...
 

Detailed Description

Wrapper and helper around system encryption routines.

Hide encryption details like: what alg. is chosen initialization details of alg. messy details allocating buffers padded to minumal key length

Create one instance per encryption/decryption operation. As such, this class makes no provisions to be multi-threaded

FUTURE: enum encryption alg posibilities and add approp accessor methods. today there is only one, PBE/DES via OpenSSL

Member Enumeration Documentation

enum Direction
protected

OpenSSL state differentation direction for API calls.

Enumerator
DECRYPT 
ENCRYPT 

Constructor & Destructor Documentation

OsEncryption ( void  )

Create one for each encryption/decryption operation.

~OsEncryption ( void  )
virtual

Member Function Documentation

void setDataPointer ( unsigned char *  pIn,
int  inLen 
)

Data to feed to encryption, not touched and NOT copied, so keep it around.

int getDataLen ( void  )

How large is the untouched data buffer.

unsigned char * getDataPointer ( void  )

Pointer to untouched data buffer.

void setResultsHeader ( const unsigned char *  header,
int  headerLen 
)

If you want to prepend this to the results header for file identification purposes.

unsigned char * getResults ( void  )

After [en/de]crypting, here's your results.

int getResultsLen ( void  )

After [en/de]crypting get your results here.

void setKey ( const unsigned char *  key,
int  keyLen 
)

set secret password

OsStatus decrypt ( void  )

operate after setting approp. input. . NOTE: This will return OS_FAILED on vxworks. */

OsStatus encrypt ( void  )

operate after setting approp. input. NOTE: This will return OS_FAILED on vxworks. */

OsStatus release ( void  )

free all, called in descructor

OsStatus init ( Direction  direction)
protected

allocate OpenSSL stuff

UtlBoolean openSslError ( void  )
protected

common handling of OpenSSL's errors

OsStatus crypto ( Direction  direction)
protected

common [en/de]crypt method

Member Data Documentation

UtlBoolean sIgnoreEncryption = FALSE
static

DEBUG turn on/off.