#include <PKIFNSSRaw.h>
This class provides an interface to symmetric key functionality provided by NSS.
TSP-enforcing: No
Definition at line 31 of file PKIFNSSRaw.h.
Public Types | |
enum | { thisComponent = TOOLKIT_CRYPTO_NSSRAW } |
Public Member Functions | |
CPKIFNSSRaw (const std::string &dbdir="") | |
virtual | ~CPKIFNSSRaw (void) |
void | Initialize () |
void | GenRandom (unsigned char *buf, int len) |
IPKIFHashContext * | HashInit (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) |
IPKIFRawCryptContext * | CryptInit (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) |
IPKIFRawCryptContext * | HMACInit (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) |
anonymous enum |
CPKIFNSSRaw::CPKIFNSSRaw | ( | const std::string & | dbdir = "" |
) |
Interface: External
This function creates CPKIFNSSRaw 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
Usually a default constructor will be called passing "" to he constructor. However a database can be specified here and used by other NSS colleagues requiring a database.
dbdir | [in] Path to the NSS database directory |
Definition at line 179 of file PKIFNSSRaw.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_NSSRAW.
CPKIFNSSRaw::~CPKIFNSSRaw | ( | void | ) | [virtual] |
Interface: External
This function destroys CPKIFNSSRaw objects
Definition at line 194 of file PKIFNSSRaw.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::Initialize | ( | void | ) | [virtual] |
Interface: External
This function initializes an instance of CPKIFCAPIRaw for use
Reimplemented from IPKIFColleague.
Definition at line 209 of file PKIFNSSRaw.cpp.
References CPKIFNSSDatabase::GetInstance(), LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
CPKIFCryptoException(PKIFNSS_RNG_FAILED) |
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 816 of file PKIFNSSRaw.cpp.
References LOG_STRING_DEBUG, PKIFNSS_RNG_FAILED, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
IPKIFHashContext * CPKIFNSSRaw::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.
CPKIFCryptoException(CRYPTO_ALG_NOT_SUPPORTED) | ||
CPKIFCryptoException(PKIFNSS_CREATE_DIGEST_CONTEXT_FAILED) | ||
CPKIFCryptoException(PKIFNSS_DIGEST_BEGIN_FAILED) |
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 849 of file PKIFNSSRaw.cpp.
References CRYPTO_ALG_NOT_SUPPORTED, LOG_STRING_DEBUG, CPKIFNSSHashContext::m_hashContext, PKIFCRYPTO::MD5, PKIFNSS_CREATE_DIGEST_CONTEXT_FAILED, PKIFNSS_DIGEST_BEGIN_FAILED, RAISE_CRYPTO_EXCEPTION, PKIFCRYPTO::SHA1, PKIFCRYPTO::SHA256, PKIFCRYPTO::SHA384, PKIFCRYPTO::SHA512, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
CPKIFCryptoException(PKIFNSS_INCORRECT_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_EMPTY_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_DIGEST_OP_FAILED) |
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 919 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFNSSHashContext::m_hashContext, PKIFNSS_DIGEST_OP_FAILED, PKIFNSS_EMPTY_HASH_CONTEXT, PKIFNSS_INCORRECT_HASH_CONTEXT, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
CPKIFCryptoException(PKIFNSS_INCORRECT_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_EMPTY_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_DIGEST_OP_FAILED) |
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 964 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFNSSHashContext::m_hashContext, PKIFNSS_DIGEST_OP_FAILED, PKIFNSS_EMPTY_HASH_CONTEXT, PKIFNSS_INCORRECT_HASH_CONTEXT, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
bool CPKIFNSSRaw::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.
true | if the algorithm specified by the key parameter is supported | |
false | if the algorithm specified by the key parameter is not supported |
CPKIFCryptoException(PKIFNSS_CERT_IMPORT_FAILED) | ||
CPKIFCryptoException(COMMON_INVALID_INPUT) |
key | [in] Reference to a CPKIFKeyMaterial object containing at least an algorithm identifier |
Implements IPKIFCryptoAlgSupport.
Definition at line 228 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, CPKIFKeyMaterial::ContainsCertificate(), CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_ALG_NOT_SUPPORTED, CPKIFKeyMaterial::GetCertificate(), CPKIFKeyMaterial::GetCertificateLength(), CPKIFException::GetErrorCode(), LOG_STRING_DEBUG, PKIFNSS_CERT_IMPORT_FAILED, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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
CPKIFCryptoException(COMMON_NOT_IMPLEMENTED) |
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] Hash algorithm used in the signature |
Implements IPKIFCryptoRawOperations.
Definition at line 313 of file PKIFNSSRaw.cpp.
References COMMON_NOT_IMPLEMENTED, LOG_STRING_DEBUG, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
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 341 of file PKIFNSSRaw.cpp.
References CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), and CryptInit().
void CPKIFNSSRaw::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.
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 378 of file PKIFNSSRaw.cpp.
References CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), and CryptInit().
bool CPKIFNSSRaw::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
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 788 of file PKIFNSSRaw.cpp.
References _Verify().
bool CPKIFNSSRaw::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
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 724 of file PKIFNSSRaw.cpp.
References CLEANUP, CPKIFCertificate::Encoded(), LOG_STRING_DEBUG, PKIFNSS_CERT_IMPORT_FAILED, RAISE_CRYPTO_EXCEPTION, and TOOLKIT_CRYPTO_NSSRAW.
IPKIFRawCryptContext * CPKIFNSSRaw::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
CPKIFCryptoException(PKIF_NSS_UNSUPPORTED_ALG) | ||
CPKIFCryptoException(PKIF_NSS_RAW_IMPORT_FAILED) | ||
CPKIFCryptoException(CRYPTO_MISSING_IV) | ||
CPKIFCryptoException(COMMON_INVALID_INPUT) | ||
CPKIFCryptoException(PKIF_NSS_IV_IMPORT_FAILED) |
key | [in] Reference to a smart 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 1019 of file PKIFNSSRaw.cpp.
References PKIFCRYPTO::CBC, COMMON_INVALID_INPUT, CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_MISSING_IV, PKIFCRYPTO::ECB, CPKIFKeyMaterial::GetIV(), CPKIFKeyMaterial::GetMode(), CPKIFKeyMaterial::GetSymmetricKey(), CPKIFKeyMaterial::GetSymmetricKeyLength(), LOG_STRING_DEBUG, CPKIFNSSRawCryptContext::m_blocksize, CPKIFNSSRawCryptContext::m_bNeedsPad, CPKIFNSSRawCryptContext::m_mech, CPKIFNSSRawCryptContext::m_padbuf, CPKIFNSSRawCryptContext::m_param, CPKIFNSSRawCryptContext::m_sk, CPKIFNSSRawCryptContext::m_slot, PKIF_NSS_IV_IMPORT_FAILED, PKIF_NSS_RAW_IMPORT_FAILED, PKIF_NSS_UNSUPPORTED_ALG, RAISE_CRYPTO_EXCEPTION, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
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 1099 of file PKIFNSSRaw.cpp.
void CPKIFNSSRaw::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
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 1126 of file PKIFNSSRaw.cpp.
IPKIFRawCryptContext * CPKIFNSSRaw::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
CPKIFCryptoException(PKIF_NSS_UNSUPPORTED_ALG) | ||
CPKIFCryptoException(PKIF_NSS_RAW_IMPORT_FAILED) | ||
CPKIFCryptoException(COMMON_INVALID_INPUT) |
Implements IPKIFCryptoRawOperations.
Definition at line 426 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, CPKIFKeyMaterial::ContainsSymmetricKeyMaterial(), CRYPTO_ALG_NOT_SUPPORTED, CPKIFKeyMaterial::GetSymmetricKey(), CPKIFKeyMaterial::GetSymmetricKeyLength(), LOG_STRING_DEBUG, CPKIFNSSRawCryptContext::m_bNeedsPad, CPKIFNSSRawCryptContext::m_ctx, CPKIFNSSRawCryptContext::m_mech, CPKIFNSSRawCryptContext::m_param, CPKIFNSSRawCryptContext::m_sk, CPKIFNSSRawCryptContext::m_slot, PKIFCRYPTO::MD5, PKIF_NSS_RAW_IMPORT_FAILED, PKIF_NSS_UNSUPPORTED_ALG, RAISE_CRYPTO_EXCEPTION, PKIFCRYPTO::SHA1, PKIFCRYPTO::SHA256, PKIFCRYPTO::SHA384, PKIFCRYPTO::SHA512, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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
CPKIFCryptoException(PKIFNSS_INCORRECT_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_EMPTY_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_DIGEST_OP_FAILED) |
Implements IPKIFCryptoRawOperations.
Definition at line 526 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFNSSRawCryptContext::m_ctx, PKIFNSS_DIGEST_OP_FAILED, PKIFNSS_EMPTY_HASH_CONTEXT, PKIFNSS_INCORRECT_HASH_CONTEXT, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
CPKIFCryptoException(PKIFNSS_INCORRECT_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_EMPTY_HASH_CONTEXT) | ||
CPKIFCryptoException(PKIFNSS_DIGEST_OP_FAILED) |
Implements IPKIFCryptoRawOperations.
Definition at line 565 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFNSSRawCryptContext::m_ctx, PKIFNSS_DIGEST_OP_FAILED, PKIFNSS_EMPTY_HASH_CONTEXT, PKIFNSS_INCORRECT_HASH_CONTEXT, RAISE_CRYPTO_EXCEPTION, thisComponent, and TOOLKIT_CRYPTO_NSSRAW.
void CPKIFNSSRaw::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.
CPKIFCryptoException(PKIFNSS_CREATE_SK_CONTEXT_FAILED) | ||
CPKIFCryptoException(COMMON_INVALID_INPUT) | ||
CPKIFCryptoException(PKIFNSS_CIPHER_OP_FAILED) |
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 1157 of file PKIFNSSRaw.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, CPKIFNSSRawCryptContext::m_blocksize, CPKIFNSSRawCryptContext::m_bNeedsPad, CPKIFNSSRawCryptContext::m_ctx, CPKIFNSSRawCryptContext::m_mech, CPKIFNSSRawCryptContext::m_padbuf, CPKIFNSSRawCryptContext::m_padlen, CPKIFNSSRawCryptContext::m_param, CPKIFNSSRawCryptContext::m_sk, CPKIFNSSRawCryptContext::m_slot, PKIFNSS_CIPHER_OP_FAILED, PKIFNSS_CREATE_SK_CONTEXT_FAILED, RAISE_CRYPTO_EXCEPTION, and TOOLKIT_CRYPTO_NSSRAW.