PKIFCAPIRaw.h

Go to the documentation of this file.
00001 
00009 #ifndef __PKIFCAPIRAW_H__
00010 #define __PKIFCAPIRAW_H__
00011 
00012 #include "PKIFdll.h"
00013 #include <wincrypt.h>
00014 //#include "atlbase.h"
00015 #include "components.h"
00016 #include "IPKIFColleague.h"
00017 #include "IPKIFCryptoRaw.h"
00018 #include "IPKIFCryptoMisc.h"
00019 
00028 class CAC_API CPKIFCAPIRaw : public IPKIFColleague, 
00029                             public IPKIFCryptoRaw, 
00030                             public IPKIFCryptoMisc
00031 {
00032 public:
00033     CPKIFCAPIRaw(void);
00034     CPKIFCAPIRaw(const char* provider, int provType);
00035     virtual ~CPKIFCAPIRaw(void);
00036 
00037     //IPKIFColleague functions
00038     void Initialize();
00039 
00040     //IPKIFCryptoMisc functions
00041     void GenRandom(unsigned char* buf, int len);
00042     IPKIFHashContext* HashInit(PKIFCRYPTO::HASH_ALG alg);
00043     void HashUpdate(IPKIFHashContext* hash, unsigned char* pData, int nDataLen);
00044     void HashFinal(IPKIFHashContext* hash, unsigned char* pResult, int* pnResultLen);
00045 
00046     //key management
00047     bool SupportsAlgorithm(const CPKIFKeyMaterial& key);
00048 
00049     //functions that operate on raw key material
00050     void Sign(const CPKIFKeyMaterial& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int* nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00051     void Decrypt(const CPKIFKeyMaterial& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool pad = true);
00052     void Encrypt(const CPKIFKeyMaterial& key, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool pad = true);
00053     bool Verify(const CPKIFKeyMaterial& key, unsigned char* pHashData, int nHashDataLen, unsigned char* pSignature, int nSignatureLen, PKIFCRYPTO::HASH_ALG hashAlg);
00054     bool VerifyCertificate(const CPKIFCertificate& issCert, const CPKIFCertificate& subCert);
00055 
00056     IPKIFRawCryptContext* CryptInit(const CPKIFKeyMaterial& key, bool pad = true);
00057     void Decrypt(IPKIFRawCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00058     void Encrypt(IPKIFRawCryptContext* cryptContext, unsigned char* pData, int nDataLen, unsigned char* pResult, int* pnResultLen, bool final);
00059 
00060     IPKIFRawCryptContext* HMACInit(const CPKIFKeyMaterial &key, PKIFCRYPTO::HASH_ALG ha);
00061     void HMACUpdate(IPKIFRawCryptContext* ctx, unsigned char* pData, int nDataLen);
00062     void HMACFinal(IPKIFRawCryptContext* ctx, unsigned char* pResult, int* pnResultLen);
00063     
00064 
00065     enum { thisComponent = TOOLKIT_CRYPTO_CAPIRAW };
00066 
00067 private:
00069     CPKIFCAPIRaw(const CPKIFCAPIRaw& copy);
00071     CPKIFCAPIRaw& operator=(const CPKIFCAPIRaw& rhs); //added 4/6/2004
00072 
00073     void InitImpl(const char * provider = NULL, int provType = 0);
00074 
00075     struct CPKIFCAPIRawImpl *m_impl;
00076 };
00077 DECLARE_SMART_POINTERS(CPKIFCAPIRaw);
00078 
00079 #endif

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