PKIFNSSAesKeyWrap.h
Go to the documentation of this file.00001
00009 #ifndef __CPKIFNSSAesKeyWrap_H__
00010 #define __CPKIFNSSAesKeyWrap_H__
00011
00012 #if _MSC_VER > 1000
00013 #pragma once
00014 #endif // _MSC_VER > 1000
00015
00016 #include "PKIFdll.h"
00017 #include "IPKIFColleague.h"
00018 #include "IPKIFCryptoRaw.h"
00019 #include "IPKIFCryptoMisc.h"
00020 #include "components.h"
00021
00030 class CAC_API CPKIFNSSAesKeyWrap : public IPKIFColleague,
00031 public IPKIFCryptoRaw
00032 {
00033 public:
00034 CPKIFNSSAesKeyWrap(void);
00035 virtual ~CPKIFNSSAesKeyWrap(void);
00036
00037
00038 void Initialize();
00039
00040
00041 bool SupportsAlgorithm(const CPKIFKeyMaterial& key);
00042
00043 void Decrypt(const CPKIFKeyMaterial& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool pad = true);
00044 void Encrypt(const CPKIFKeyMaterial& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool pad = true);
00045
00046 IPKIFRawCryptContext* CryptInit(const CPKIFKeyMaterial& key, bool pad = true);
00047 void Decrypt(IPKIFRawCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00048 void Encrypt(IPKIFRawCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00049
00050
00051
00052
00053 void Sign(const CPKIFKeyMaterial& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int* nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00054 bool Verify(const CPKIFKeyMaterial& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00055 bool VerifyCertificate(const CPKIFCertificate& issCert, const CPKIFCertificate& subCert);
00056
00057 IPKIFRawCryptContext* HMACInit(const CPKIFKeyMaterial &key, PKIFCRYPTO::HASH_ALG ha);
00058 void HMACUpdate(IPKIFRawCryptContext* ctx, unsigned char* pData, int nDataLen);
00059 void HMACFinal(IPKIFRawCryptContext* ctx, unsigned char* pResult, int* pnResultLen);
00060
00061
00062
00063 enum { thisComponent = TOOLKIT_CRYPTO_NSSRAW };
00064
00065 protected:
00066 template <bool _CryptDirection> void CryptFunc(IPKIFRawCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00067
00068 private:
00070 CPKIFNSSAesKeyWrap(const CPKIFNSSAesKeyWrap& copy);
00072 CPKIFNSSAesKeyWrap& operator=(const CPKIFNSSAesKeyWrap& rhs);
00073
00074 };
00075 DECLARE_SMART_POINTERS(CPKIFNSSAesKeyWrap);
00076
00077 #endif // !defined(__PKIFNSSRAW_H__)
00078