|
sipxportlib
Version 3.3
|
A generic cryptography key base class. More...
#include <UtlCryptoKey.h>

Public Types | |
| enum | KeyType { KEY_INVALID, KEY_SYMMETRIC, KEY_PRIVATE, KEY_PUBLIC, NUM_KEY_TYPES } |
| What type of Key is this? More... | |
Public Member Functions | |
Creators | |
| UtlCryptoKey () | |
| Constructor. More... | |
| virtual | ~UtlCryptoKey () |
| Destructor. More... | |
| virtual int | generateKey ()=0 |
| Generates a new RSA private/public key pair. More... | |
| virtual int | importFromFile (const char *pFilename) |
| Imports a key from the given file. More... | |
| virtual int | loadBinaryKey (const unsigned char *pSrc, int srcLen) |
| Loads a binary key value. More... | |
| virtual UtlCryptoData * | getBinaryKey () const |
| Retrieves a binary key value (for later use by loadBinaryKey) More... | |
| virtual int | getMaxEncryptedSize (int srcLen) const =0 |
| Returns the max encrypted size of srcLen bytes from encrypt() More... | |
| virtual int | encrypt (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) const =0 |
| Encrypts the given source data with the current key. More... | |
| virtual UtlCryptoData * | encrypt (const unsigned char *pSrc, int srcLen) const |
| Encrypts the given source data with the current key. More... | |
| virtual int | getMaxDecryptedSize (int srcLen) const =0 |
| Returns the max decrypted size of srcLen bytes from decrypt() More... | |
| virtual int | decrypt (const unsigned char *pSrc, int srcLen, unsigned char *pDest, int *pDestLen) const =0 |
| Decrypts 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... | |
Accessors | |
| bool | isValid () const |
| bool | isPrivate () const |
| bool | isPublic () const |
| bool | isSymmetric () const |
| KeyType | getKeyType () const |
| unsigned long | getLastError () const |
| virtual UtlString | output () const |
Static Public Member Functions | |
| 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 | |
| KeyType | setKeyType (KeyType type) |
| unsigned long | setLastError (unsigned long err) const |
| virtual void | clearKey () |
Static Protected Member Functions | |
| 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 | |
| static const char | sBase64Chars [] |
| Set of base64 chars. More... | |
A generic cryptography key base class.
| enum KeyType |
| UtlCryptoKey | ( | ) |
Constructor.
|
virtual |
Destructor.
|
pure virtual |
Generates a new RSA private/public key pair.
Implemented in UtlCryptoKeySym, and UtlCryptoKeyRsa.
|
virtual |
Imports a key from the given file.
Reimplemented in UtlCryptoKeyRsa.
|
virtual |
Loads a binary key value.
Reimplemented in UtlCryptoKeySym.
|
virtual |
Retrieves a binary key value (for later use by loadBinaryKey)
Reimplemented in UtlCryptoKeySym.
|
pure virtual |
Returns the max encrypted size of srcLen bytes from encrypt()
Implemented in UtlCryptoKeySym, and UtlCryptoKeyRsa.
|
pure 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 |
Implemented in UtlCryptoKeySym, and UtlCryptoKeyRsa.
|
virtual |
Encrypts the given source data with the current key.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
|
pure virtual |
Returns the max decrypted size of srcLen bytes from decrypt()
Implemented in UtlCryptoKeySym, and UtlCryptoKeyRsa.
|
pure 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 |
Implemented in UtlCryptoKeySym, and UtlCryptoKeyRsa.
|
virtual |
Decrypts the given source data with the current key.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
|
virtual |
Signing & verifying.
Reimplemented in UtlCryptoKeyRsa.
|
virtual |
Signs source data.
| [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 |
Reimplemented in UtlCryptoKeyRsa.
|
virtual |
Signs source data.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
|
virtual |
Verifies that the signature is valid for the source data.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
| [in] | pSig | - Signature data |
| [in] | sigLen | - Signature data len |
Reimplemented in UtlCryptoKeyRsa.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
Reimplemented in UtlCryptoKeyRsa, and UtlCryptoKeySym.
|
static |
Returns the digest algorithm type that computeDigest() will return.
|
static |
Returns the max size of a digest that computeDigest() will return.
|
static |
Computes message digest (MD) of given data.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
| [in] | pDest | - Destination buffer |
| [out] | pDestLen | - Size of destination buffer and actual size after operation |
|
static |
Computes message digest (MD) of given data.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
|
static |
Returns the max base64-encoded size of srcLen bytes from base64Encode.
|
static |
Encodes the given binary data in base64 format.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
| [in] | pDest | - Destination buffer |
| [out] | pDestLen | - Size of destination buffer and actual size after operation |
|
static |
Encodes the given binary data in base64 format.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
|
static |
Returns the max decoded size of srcLen bytes from base64Decode.
|
static |
Decodes the given base64 data into binary format.
| [in] | pSrc | - Source data |
| [in] | srcLen | - Source data len |
| [in] | pDest | - Destination buffer |
| [out] | pDestLen | - Size of destination buffer and actual size after operation |
|
static |
Decodes the given base64 data into binary format.
| [in] | pSrc | - Source data |
| [in] | pDest | - Destination buffer |
| [out] | pDestLen | - Size of destination buffer and actual size after operation |
|
static |
Decodes the given base64 data into binary format.
| [in] | pSrc | - Source data |
| [in] | srcLen | - length of source data |
|
static |
Decodes the given base64 data into binary format.
| [in] | pSrc | - Source data |
|
inlineprotected |
|
protected |
|
protectedvirtual |
|
staticprotected |
Decode base64 character.
|
staticprotected |
Returns true if the given char is a base64 char.
|
staticprotected |
Set of base64 chars.
1.8.11