sipxportlib
Version 3.3
|
A symmetric key implementation of UtlCryptoKey. More...
#include <UtlCryptoKeySym.h>
Public Member Functions | |
Creators | |
UtlCryptoKeySym () | |
Constructor. More... | |
~UtlCryptoKeySym () | |
Destructor. More... | |
Manipulators | |
int | generateKey () |
Generates a new key. More... | |
int | loadBinaryKey (const unsigned char *pSrc, int srcLen) |
Loads a binary key value. More... | |
UtlCryptoData * | getBinaryKey () const |
Retrieves a binary key value (for later use by loadBinaryKey) More... | |
int | getMaxEncryptedSize (int srcLen) const |
Returns the max encrypted size of srcLen bytes from encrypt() More... | |
int | encrypt (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) const |
Encrypts the given source data with the current key. More... | |
int | getMaxDecryptedSize (int srcLen) const |
Returns the max decrypted size of srcLen bytes from decrypt() More... | |
int | decrypt (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) const |
Decrypts the given source data with the current key. More... | |
Inquiry | |
int | getTotalKeyLength () |
Return total key length. More... | |
UtlBoolean | getBinaryKey (char *buffer, int bufferLength) |
Dump key to memeory. More... | |
UtlString | output () const |
Get humane-readable describe. More... | |
Public Member Functions inherited from UtlCryptoKey | |
UtlCryptoKey () | |
Constructor. More... | |
virtual | ~UtlCryptoKey () |
Destructor. More... | |
virtual int | importFromFile (const char *pFilename) |
Imports a key from the given file. More... | |
virtual UtlCryptoData * | encrypt (const unsigned char *pSrc, int srcLen) const |
Encrypts the given source data with the current key. More... | |
virtual UtlCryptoData * | decrypt (const unsigned char *pSrc, int srcLen) const |
Decrypts the given source data with the current key. More... | |
virtual int | getMaxSignatureSize (int srcLen) const |
Signing & verifying. More... | |
virtual int | sign (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) const |
Signs source data. More... | |
virtual UtlCryptoData * | sign (const unsigned char *pSrc, int srcLen) const |
Signs source data. More... | |
virtual int | verify (const unsigned char *pSrc, int srcLen, const unsigned char *pSig, int sigLen) const |
Verifies that the signature is valid for the source data. More... | |
bool | isValid () const |
bool | isPrivate () const |
bool | isPublic () const |
bool | isSymmetric () const |
KeyType | getKeyType () const |
unsigned long | getLastError () const |
Additional Inherited Members | |
Public Types inherited from UtlCryptoKey | |
enum | KeyType { KEY_INVALID, KEY_SYMMETRIC, KEY_PRIVATE, KEY_PUBLIC, NUM_KEY_TYPES } |
What type of Key is this? More... | |
Static Public Member Functions inherited from UtlCryptoKey | |
static int | getDigestAlgType () |
Returns the digest algorithm type that computeDigest() will return. More... | |
static int | getMaxDigestSize (int srcLen) |
Returns the max size of a digest that computeDigest() will return. More... | |
static int | computeDigest (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) |
Computes message digest (MD) of given data. More... | |
static UtlCryptoData * | computeDigest (const unsigned char *pSrc, int srcLen) |
Computes message digest (MD) of given data. More... | |
static int | getMaxBase64EncodedSize (int srcLen) |
Returns the max base64-encoded size of srcLen bytes from base64Encode. More... | |
static int | base64Encode (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) |
Encodes the given binary data in base64 format. More... | |
static UtlString | base64Encode (const unsigned char *pSrc, int srcLen) |
Encodes the given binary data in base64 format. More... | |
static int | getMaxBase64DecodedSize (int srcLen) |
Returns the max decoded size of srcLen bytes from base64Decode. More... | |
static int | base64Decode (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) |
Decodes the given base64 data into binary format. More... | |
static int | base64Decode (const UtlString &pSrc, unsigned char *pDest, int *pDestLen) |
Decodes the given base64 data into binary format. More... | |
static UtlCryptoData * | base64Decode (const unsigned char *pSrc, int srcLen) |
Decodes the given base64 data into binary format. More... | |
static UtlCryptoData * | base64Decode (const UtlString &pSrc) |
Decodes the given base64 data into binary format. More... | |
Protected Member Functions inherited from UtlCryptoKey | |
KeyType | setKeyType (KeyType type) |
unsigned long | setLastError (unsigned long err) const |
Static Protected Member Functions inherited from UtlCryptoKey | |
static int | getBase64Idx (unsigned char c) |
Decode base64 character. More... | |
static bool | isBase64 (unsigned char c) |
Returns true if the given char is a base64 char. More... | |
Static Protected Attributes inherited from UtlCryptoKey | |
static const char | sBase64Chars [] |
Set of base64 chars. More... | |
A symmetric key implementation of UtlCryptoKey.
UtlCryptoKeySym | ( | ) |
Constructor.
~UtlCryptoKeySym | ( | ) |
Destructor.
|
virtual |
Generates a new key.
: Don't use it due the not strong algorithm, for testing only
Implements UtlCryptoKey.
|
virtual |
|
virtual |
Retrieves a binary key value (for later use by loadBinaryKey)
Reimplemented from UtlCryptoKey.
|
virtual |
Returns the max encrypted size of srcLen bytes from encrypt()
Implements UtlCryptoKey.
|
virtual |
Encrypts the given source data with the current key.
[in] | pSrc | - Source data |
[in] | srcLen | - Source data len |
[out] | pDest | - Destination buffer |
[in,out] | pDestLen | - Size of destination buffer and actual encrypted size after operation |
Implements UtlCryptoKey.
|
virtual |
Returns the max decrypted size of srcLen bytes from decrypt()
Implements UtlCryptoKey.
|
virtual |
Decrypts the given source data with the current key.
[in] | pSrc | - Source data |
[in] | srcLen | - Source data len |
[out] | pDest | - Destination buffer |
[in,out] | pDestLen | - Size of destination buffer and actual decrypted size after operation |
Implements UtlCryptoKey.
int getTotalKeyLength | ( | ) |
Return total key length.
UtlBoolean getBinaryKey | ( | char * | buffer, |
int | bufferLength | ||
) |
Dump key to memeory.
|
virtual |
Get humane-readable describe.
Reimplemented from UtlCryptoKey.