CPKIFCryptoPPRaw Class Reference

#include <PKIFCryptoPPRaw.h>

Inheritance diagram for CPKIFCryptoPPRaw:

Inheritance graph
[legend]
Collaboration diagram for CPKIFCryptoPPRaw:

Collaboration graph
[legend]

List of all members.


Detailed Description

Applications do not typically operate directly on colleague objects. Information provided in this section is intended for developers creating custom colleagues that implement similar functionality.

This class provides an interface to symmetric key functionality provided by Crypto++.

TSP-enforcing: No

Definition at line 27 of file PKIFCryptoPPRaw.h.


Public Types

enum  { thisComponent = TOOLKIT_CRYPTO_CRYPTOPPRAW }

Public Member Functions

 CPKIFCryptoPPRaw (void)
virtual ~CPKIFCryptoPPRaw (void)
void Initialize ()
void GenRandom (unsigned char *buf, int len)
IPKIFHashContextHashInit (PKIFCRYPTO::HASH_ALG alg)
void HashUpdate (IPKIFHashContext *hash, unsigned char *pData, int nDataLen)
void HashFinal (IPKIFHashContext *hash, unsigned char *pResult, int *pnResultLen)
bool SupportsAlgorithm (const CPKIFKeyMaterial &key)
void Sign (const CPKIFKeyMaterial &key, unsigned char *pHashData, int nHashDataLen, unsigned char *pSignature, int *nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg)
void Decrypt (const CPKIFKeyMaterial &key, unsigned char *pData, int nDataLen, unsigned char *pResult, int *pnResultLen, bool pad=true)
void Encrypt (const CPKIFKeyMaterial &key, unsigned char *pData, int nDataLen, unsigned char *pResult, int *pnResultLen, bool pad=true)
bool Verify (const CPKIFKeyMaterial &key, unsigned char *pHashData, int nHashDataLen, unsigned char *pSignature, int nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg)
bool VerifyCertificate (const CPKIFCertificate &issCert, const CPKIFCertificate &subCert)
IPKIFRawCryptContextCryptInit (const CPKIFKeyMaterial &key, bool pad=true)
void Decrypt (IPKIFRawCryptContext *cryptContext, unsigned char *pData, int nDataLen, unsigned char *pResult, int *pnResultLen, bool final)
void Encrypt (IPKIFRawCryptContext *cryptContext, unsigned char *pData, int nDataLen, unsigned char *pResult, int *pnResultLen, bool final)
IPKIFRawCryptContextHMACInit (const CPKIFKeyMaterial &key, PKIFCRYPTO::HASH_ALG ha)
void HMACUpdate (IPKIFRawCryptContext *ctx, unsigned char *pData, int nDataLen)
void HMACFinal (IPKIFRawCryptContext *ctx, unsigned char *pResult, int *pnResultLen)

Protected Member Functions

template<bool _CryptDirection>
void CryptFunc (IPKIFRawCryptContext *cryptContext, unsigned char *pData, int nDataLen, unsigned char *pResult, int *pnResultLen, bool final)

Member Enumeration Documentation

anonymous enum

Enumerator:
thisComponent 

Definition at line 64 of file PKIFCryptoPPRaw.h.


Constructor & Destructor Documentation

CPKIFCryptoPPRaw::CPKIFCryptoPPRaw ( void   ) 

Interface: External

This function creates CPKIFCryptoPPRaw objects. As with all colleague objects, a call to Initialize is necessary before using instances of this class, i.e. construction and initialization requires two steps

Returns:
None

Definition at line 66 of file PKIFCryptoPPRaw.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

CPKIFCryptoPPRaw::~CPKIFCryptoPPRaw ( void   )  [virtual]

Interface: External

This function destroys CPKIFCryptoPPRaw objects

Returns:
None

Definition at line 77 of file PKIFCryptoPPRaw.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_CRYPTOPPRAW.


Member Function Documentation

void CPKIFCryptoPPRaw::Initialize ( void   )  [virtual]

Interface: External

This function initializes an instance of CPKIFCryptoPPRaw for use

Returns:
None

Reimplemented from IPKIFColleague.

Definition at line 88 of file PKIFCryptoPPRaw.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

Referenced by GetPlatformCryptoMisc(), and GetPlatformCryptoRaw().

void CPKIFCryptoPPRaw::GenRandom ( unsigned char *  buf,
int  len 
) [virtual]

Interface: External

This function will populate buf with len bytes of random data. The buf parameter is assumed to be at least len bytes in size.

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFNSS_RNG_FAILED) 
Parameters:
buf  [in/out] Pointer to a buffer of at least len b ytes to receive randomly generated data
len  [in] Integer identifying the number of random bytes desired and the size of the buf parameter

Implements IPKIFCryptoMisc.

Definition at line 645 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

IPKIFHashContext * CPKIFCryptoPPRaw::HashInit ( PKIFCRYPTO::HASH_ALG  alg  )  [virtual]

Interface: External

This function is used to prepare a hash context object that uses the specified algorithm to produce a hash of data subsequently passed to HashUpdate using the returned context. See HashFinal in the CPKIFCryptoMediator2 section for a complete hashing example.

Returns:
A pointer to IPKIFHashContext object
Exceptions:
CPKIFCryptoException(CRYPTO_ALG_NOT_SUPPORTED) 
CPKIFCryptoException(PKIFNSS_CREATE_DIGEST_CONTEXT_FAILED) 
CPKIFCryptoException(PKIFNSS_DIGEST_BEGIN_FAILED) 
Parameters:
alg  [in] HASH_ALG value indicating the type of hash algorithm for which a hash context object should be created

Implements IPKIFCryptoMisc.

Definition at line 677 of file PKIFCryptoPPRaw.cpp.

References CRYPTO_ALG_NOT_SUPPORTED, LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTO::MD5, RAISE_CRYPTO_EXCEPTION, PKIFCRYPTO::SHA1, PKIFCRYPTO::SHA224, PKIFCRYPTO::SHA256, PKIFCRYPTO::SHA384, PKIFCRYPTO::SHA512, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

Referenced by VerifyCertificate().

void CPKIFCryptoPPRaw::HashUpdate ( IPKIFHashContext hash,
unsigned char *  pData,
int  nDataLen 
) [virtual]

Interface: External

This function is used to contribute data to a hash context. See HashFinal in the CPKIFCryptoMediator2 section for a complete hashing example.

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT) 
CPKIFCryptoException(PKIFCRYPTOPP_EMPTY_HASH_CONTEXT) 
Parameters:
hash  [in] Pointers to an IPKIFHashContext object created by a previous call to HashInit
pData  [in] Pointer to a buffer containing data that should be hashed as part of the running hash operation
nDataLen  [in] Integer indicating the length of the buffer passed via the pData parameter

Implements IPKIFCryptoMisc.

Definition at line 728 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTOPP_EMPTY_HASH_CONTEXT, PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

Referenced by VerifyCertificate().

void CPKIFCryptoPPRaw::HashFinal ( IPKIFHashContext hash,
unsigned char *  pResult,
int *  pnResultLen 
) [virtual]

Interface: External

This function is used to retrieve the result from a hash context. Hash contexts are not valid after a call to HashFinal and should be deleted. See HashFinal in the CPKIFCryptoMediator2 section for a complete hashing example.

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT) 
CPKIFCryptoException(PKIFCRYPTOPP_EMPTY_HASH_CONTEXT) 
Parameters:
hash  [in] Pointers to an IPKIFHashContext object created by a previous call to HashInit
pResult  [out] Pointer to a buffer of sufficient size to receive the result of a hash operation
pnResultLen  [in/out] Pointer to an integer used to pass the length of the pResult parameter to HashFinal and to return the size of the hash result passed from HashFinal

Implements IPKIFCryptoMisc.

Definition at line 768 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTOPP_EMPTY_HASH_CONTEXT, PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

Referenced by VerifyCertificate().

bool CPKIFCryptoPPRaw::SupportsAlgorithm ( const CPKIFKeyMaterial key  )  [virtual]

Interface: External

This function is used to query an instance for support of the algorithm identified by the key parameter.

Return values:
true if the algorithm specified by the key parameter is supported
false if the algorithm specified by the key parameter is not supported
Exceptions:
CPKIFCryptoException(PKIFNSS_CERT_IMPORT_FAILED) 
CPKIFCryptoException(COMMON_INVALID_INPUT) 
Parameters:
key  [in] Reference to a CPKIFKeyMaterial object containing at least an algorithm identifier

Implements IPKIFCryptoAlgSupport.

Definition at line 103 of file PKIFCryptoPPRaw.cpp.

References PKIFCRYPTO::AES, PKIFCRYPTO::AES128, PKIFCRYPTO::AES192, PKIFCRYPTO::AES256, CPKIFAlgorithm::AsymkeyAlg(), CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_ALG_NOT_SUPPORTED, PKIFCRYPTO::DSS, PKIFCRYPTO::ECC, CPKIFAlgorithm::GetAlg(), CPKIFException::GetErrorCode(), CPKIFKeyMaterial::GetSubjectPublicKeyInfo(), CPKIFKeyMaterial::GetSymmetricKeyAlgorithm(), LOG_STRING_DEBUG, PKIFCRYPTO::RSA, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

void CPKIFCryptoPPRaw::Sign ( const CPKIFKeyMaterial key,
unsigned char *  pHashData,
int  nHashDataLen,
unsigned char *  pSignature,
int *  nSignatureLen,
PKIFCRYPTO::HASH_ALG  hashAlg 
) [virtual]

Interface: External

This function throws an exception. Digital signature generation using raw key material is not currently supported

Returns:
None
Exceptions:
CPKIFCryptoException(COMMON_NOT_IMPLEMENTED) 
Parameters:
key  [in] Reference to a CPKIFKeyMaterial object containing key material to use for signature generation
pHashData  [in] Pointer to a buffer containing the message digest to sign
nHashDataLen  [in] Integer indicating the length of the buffer passed via the pHashData parameter
pSignature  [out] Pointer to a buffer to receive the generated digital signature
nSignatureLen  [in/out] Pointer to a integer used to pass the size of the pSignature buffer to Sign and to return the size of the generated signature from
hashAlg  [in] digest algorithm to use

Implements IPKIFCryptoRawOperations.

Definition at line 168 of file PKIFCryptoPPRaw.cpp.

References COMMON_NOT_IMPLEMENTED, LOG_STRING_DEBUG, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

void CPKIFCryptoPPRaw::Decrypt ( const CPKIFKeyMaterial key,
unsigned char *  pData,
int  nDataLen,
unsigned char *  pResult,
int *  pnResultLen,
bool  pad = true 
) [virtual]

Interface: External

This function performs decryption using symmetric key material. This function takes a key material object.

Returns:
None
Parameters:
key  [in] Reference to a CPKIFKeyMaterial object containing key material to use when performing crypto operations
pData  [in] Pointer to a buffer containing input data
nDataLen  [in] Integer indicating the size of the buffer passed via the pData parameter
pResult  [out] Pointer to a buffer to receive the resulting data
pnResultLen  [in/out] Pointer to an integer used to pass the size of the pResult parameter to Decrypt and to return the size of the resulting data
pad  [in] boolean value that indicates whether padding should be handled by the crypto engine. PKCS#1 padding will apply to RSA keys, PKCS#5 padding to symmetric keys. All other padding schemes must be handled by the caller.

Implements IPKIFCryptoRawOperations.

Definition at line 195 of file PKIFCryptoPPRaw.cpp.

References CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), and CryptInit().

void CPKIFCryptoPPRaw::Encrypt ( const CPKIFKeyMaterial key,
unsigned char *  pData,
int  nDataLen,
unsigned char *  pResult,
int *  pnResultLen,
bool  pad = true 
) [virtual]

Interface: External

This function performs encryption using symmetric key material. This function takes a key material object.

Returns:
None
Parameters:
key  [in] Reference to a CPKIFKeyMaterial object containing key material to use when performing crypto operations
pData  [in] Pointer to a buffer containing input data
nDataLen  [in] Integer indicating the size of the buffer passed via the pData parameter
pResult  [out] Pointer to a buffer to receive the resulting data
pnResultLen  [in/out] Pointer to an integer used to pass the size of the pResult parameter to Decrypt and to return the size of the resulting data
pad  [in] boolean value that indicates whether padding should be handled by the crypto engine. PKCS#1 padding will apply to RSA keys, PKCS#5 padding to symmetric keys. All other padding schemes must be handled by the caller.

Implements IPKIFCryptoRawOperations.

Definition at line 232 of file PKIFCryptoPPRaw.cpp.

References CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), and CryptInit().

bool CPKIFCryptoPPRaw::Verify ( const CPKIFKeyMaterial key,
unsigned char *  pHashData,
int  nHashDataLen,
unsigned char *  pSignature,
int  nSignatureLen,
PKIFCRYPTO::HASH_ALG  hashAlg 
) [virtual]

Interface: External

This function verifies a digital signature over the given data using the public key from the specified key (which most likely includes an X.509 certificate). All Verify functions assume the data passed is a hash of the data to be verified, i.e. this function perform no hashing

Returns:
This function returns true if the signature verifies and false otherwise. Some errors can result in exceptions
Parameters:
key  [in] Reference to a CPKIFKeyMaterial object containing key material to use when verifying the signature
pHashData  [in] Pointer to a buffer containing the message digest that was signed to produce the signature conveyed via the pSignature parameter
nHashDataLen  [in] Integer indicating the length of the value passed via the pHashData parameter
pSignature  [in] Pointer to a buffer containing the signature to verify
nSignatureLen  [in] Integer indicating the size of the value passed via the pSignature parameter
hashAlg  [in] Hash algorithm used with signature

Implements IPKIFCryptoRawOperations.

Definition at line 618 of file PKIFCryptoPPRaw.cpp.

References _Verify().

bool CPKIFCryptoPPRaw::VerifyCertificate ( const CPKIFCertificate issCert,
const CPKIFCertificate subCert 
) [virtual]

Interface: External

This convenience function can be used to verify signatures on a certificate given a subject certificate and the certificate of its issuer

Returns:
This function returns true if the signature on subCert can be verified using the public key material from issCert
Parameters:
issCert  [in] Reference to a smart pointer to a CPKIFCertificate object containing the certificate to use when verifying the certificate passed via the subCert parameter
subCert  [in] Reference to a smart pointer to a CPKIFCertificate object containing the certificate to verify using the certificate passed via the issCert parameter

Implements IPKIFCryptoRawOperations.

Definition at line 551 of file PKIFCryptoPPRaw.cpp.

References _Verify(), CPKIFAlgorithm::GetAlg(), GetTBSCertSequence(), CPKIFAlgorithm::HashAlg(), HashFinal(), HashInit(), HashUpdate(), PKIF_CRYPTOPP_UNSUPPORTED_ALG, CPKIFCertificate::Signature(), CPKIFCertificate::SignatureAlgorithm(), and TOOLKIT_CRYPTO_CRYPTOPPRAW.

IPKIFRawCryptContext * CPKIFCryptoPPRaw::CryptInit ( const CPKIFKeyMaterial key,
bool  pad = true 
) [virtual]

Interface: External

This function is used to prepare a crypt context object with presented key material. The crypt context object may then be passed to operations that perform cryptographic operations using the key material. This function is typically used to prepare for operations on large amounts of data. This function may generate an exception containing one of the following error codes

Returns:
A poiter to IPKIFRawCryptContext
Exceptions:
CPKIFCryptoException(PKIF_CRYPTOPP_UNSUPPORTED_ALG) 
CPKIFCryptoException(CRYPTO_MISSING_IV) 
CPKIFCryptoException(COMMON_INVALID_INPUT) 
Parameters:
key  [in] Pointer to a CPKIFKeyMaterial object containing the key material to use for an Encryption or Decryption operation
pad  [in] A boolean value indicating if padding should be applied

Implements IPKIFCryptoRawOperations.

Definition at line 818 of file PKIFCryptoPPRaw.cpp.

References PKIFCRYPTO::AES, PKIFCRYPTO::AES128, PKIFCRYPTO::AES192, PKIFCRYPTO::AES256, PKIFCRYPTO::CBC, COMMON_INVALID_INPUT, CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_MISSING_IV, CPKIFAlgorithm::GetAlg(), CPKIFKeyMaterial::GetIV(), CPKIFKeyMaterial::GetMode(), CPKIFKeyMaterial::GetSymmetricKey(), CPKIFKeyMaterial::GetSymmetricKeyAlgorithm(), CPKIFKeyMaterial::GetSymmetricKeyLength(), LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_bNeedsPad, CPKIFCryptoPPRawContext::m_iv, CPKIFCryptoPPRawContext::m_ivLen, CPKIFCryptoPPRawContext::m_keyAlgorithm, CPKIFCryptoPPRawContext::m_keyLen, CPKIFCryptoPPRawContext::m_keyMode, CPKIFCryptoPPRawContext::m_rawKey, PKIF_CRYPTOPP_UNSUPPORTED_ALG, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

Referenced by Decrypt(), and Encrypt().

void CPKIFCryptoPPRaw::Decrypt ( IPKIFRawCryptContext cryptContext,
unsigned char *  pData,
int  nDataLen,
unsigned char *  pResult,
int *  pnResultLen,
bool  final 
) [virtual]

Interface: External

This function performs decryption using symmetric key material. This function takes a crypt context and can be used when operating on large blocks of data.

Returns:
None
Parameters:
cryptContext  [in] Pointer to an IPKIFRawCryptContext object created via a call to CryptInit and containing the key material to use when decrypting
pData  [in] Pointer to a buffer containing ciphertext to decrypt
nDataLen  [in] Integer indicating the size of the buffer passed via the pData parameter
pResult  [out] Pointer to a buffer to receive the decrypted data
pnResultLen  [in/out] Pointer to an integer used to pass the size of the pResult parameter to Decrypt and to return the size of the decrypted data
final  [in] Boolean that indicates if more data will be passed via a subsequent call to Decrypt (false if more data will be passed and true if this is the final call to Decrypt for this ciphertext)

Implements IPKIFCryptoRawOperations.

Definition at line 876 of file PKIFCryptoPPRaw.cpp.

void CPKIFCryptoPPRaw::Encrypt ( IPKIFRawCryptContext cryptContext,
unsigned char *  pData,
int  nDataLen,
unsigned char *  pResult,
int *  pnResultLen,
bool  final 
) [virtual]

Interface: External

This function performs encryption using symmetric key material. This function takes a crypt context and can be used when operating on large blocks of data

Returns:
None
Parameters:
cryptContext  [in] Pointer to an IPKIFRawCryptContext object created via a call to CryptInit and containing the key material to use when encrypting
pData  [in] Pointer to a buffer containing plaintext to encrypt
nDataLen  [in] Integer indicating the size of the buffer passed via the pData parameter
pResult  [out] Pointer to a buffer to receive the encrypted data
pnResultLen  [in/out] Pointer to an integer used to pass the size of the pResult parameter to Encrypt and to return the size of the encrypted data
final  [in] Boolean that indicates if more data will be passed via a subsequent call to Encrypt (false if more data will be passed and true if this is the final call to Encrypt for this plaintext)

Implements IPKIFCryptoRawOperations.

Definition at line 903 of file PKIFCryptoPPRaw.cpp.

IPKIFRawCryptContext * CPKIFCryptoPPRaw::HMACInit ( const CPKIFKeyMaterial key,
PKIFCRYPTO::HASH_ALG  ha 
) [virtual]

Interface: External

This function is used to initialize an HMAC context with a symmetric key and hash algorithm. It returs a context which may then be passed to HMACUpdate and HMACFinal to produce a message authentication code using the key material.

This function may generate an exception containing one of the following error codes

Returns:
A poiter to IPKIFRawCryptContext
Exceptions:
CPKIFCryptoException(PKIF_NSS_UNSUPPORTED_ALG) 
CPKIFCryptoException(PKIF_NSS_RAW_IMPORT_FAILED) 
CPKIFCryptoException(COMMON_INVALID_INPUT) 

defined(FIPS_MODE)

Implements IPKIFCryptoRawOperations.

Definition at line 280 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_ALG_NOT_SUPPORTED, CPKIFKeyMaterial::GetSymmetricKey(), CPKIFKeyMaterial::GetSymmetricKeyLength(), LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTO::MD5, RAISE_CRYPTO_EXCEPTION, PKIFCRYPTO::SHA1, PKIFCRYPTO::SHA256, PKIFCRYPTO::SHA384, PKIFCRYPTO::SHA512, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

void CPKIFCryptoPPRaw::HMACUpdate ( IPKIFRawCryptContext ctx,
unsigned char *  pData,
int  nDataLen 
) [virtual]

Interface: External

This function is used to contribute data to an HMAC context. Once an HMAC context is established, it operates identically to a hash context

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT) 
CPKIFCryptoException(PKIFCRYPTOPP_EMPTY_HASH_CONTEXT) 

Implements IPKIFCryptoRawOperations.

Definition at line 336 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTOPP_EMPTY_HASH_CONTEXT, PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

void CPKIFCryptoPPRaw::HMACFinal ( IPKIFRawCryptContext ctx,
unsigned char *  pResult,
int *  pnResultLen 
) [virtual]

Interface: External

This function is used to retrieve the result from an HMAC context. HMAC contexts are not valid after a call to HMACFinal and should be deleted.

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT) 
CPKIFCryptoException(PKIFCRYPTOPP_EMPTY_HASH_CONTEXT) 

Implements IPKIFCryptoRawOperations.

Definition at line 369 of file PKIFCryptoPPRaw.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_hashCtx, PKIFCRYPTOPP_EMPTY_HASH_CONTEXT, PKIFCRYPTOPP_INCORRECT_HASH_CONTEXT, thisComponent, and TOOLKIT_CRYPTO_CRYPTOPPRAW.

template<bool _CryptDirection>
void CPKIFCryptoPPRaw::CryptFunc ( IPKIFRawCryptContext cryptContext,
unsigned char *  pData,
int  nDataLen,
unsigned char *  pResult,
int *  pnResultLen,
bool  final 
) [inline, protected]

Interface: Module

This is a helper function that conducts cryptographic operations.

Returns:
None
Exceptions:
CPKIFCryptoException(PKIFNSS_CREATE_SK_CONTEXT_FAILED) 
CPKIFCryptoException(COMMON_INVALID_INPUT) 
CPKIFCryptoException(PKIFNSS_CIPHER_OP_FAILED) 
Parameters:
cryptContext  [in] Pointer to an IPKIFRawCryptContext object created via a call to CryptInit and containing the key material to use when encrypting
pData  Poiter to a buffer containing data to encrypt or decrypt
nDataLen  Length of data to encrypt or decrypt
pResult  Poiter to a buffer containing the result of encrypt or decrypt operation
pnResultLen  Length of the resulting data
final  Boolean value specifying whether this is the last section in a series being encrypted. Final is set TRUE for the last or only block and FALSE if there are more blocks to be encrypted

Definition at line 934 of file PKIFCryptoPPRaw.cpp.

References PKIFCRYPTO::AES, PKIFCRYPTO::AES128, PKIFCRYPTO::AES192, PKIFCRYPTO::AES256, CPKIFAlgorithm::BlockSize(), PKIFCRYPTO::CBC, COMMON_INVALID_INPUT, PKIFCRYPTO::CTR, PKIFCRYPTO::ECB, CPKIFAlgorithm::GetAlg(), LOG_STRING_DEBUG, CPKIFCryptoPPRawContext::m_bNeedsPad, CPKIFCryptoPPRawContext::m_ctx, CPKIFCryptoPPRawContext::m_iv, CPKIFCryptoPPRawContext::m_keyAlgorithm, CPKIFCryptoPPRawContext::m_keyLen, CPKIFCryptoPPRawContext::m_keyMode, CPKIFCryptoPPRawContext::m_rawKey, RAISE_CRYPTO_EXCEPTION, and TOOLKIT_CRYPTO_CRYPTOPPRAW.


The documentation for this class was generated from the following files:

Generated on Mon Nov 15 11:20:12 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6