CAPIRawCryptContext.cpp

Go to the documentation of this file.
00001 
00009 #include "CAPIRawCryptContext.h"
00010 #include "ToolkitUtils.h"
00011 #include "PKIFMemoryUtils.h"
00012 #include "components.h"
00013 
00014 
00022 CPKIFCAPIRawCryptContext::CPKIFCAPIRawCryptContext(void)
00023 {
00024     LOG_STRING_DEBUG("CPKIFCAPIRawCryptContext::CPKIFCAPIRawCryptContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00025 
00026     m_cryptContext = NULL;
00027     m_sessionKey = NULL;
00028     m_hKey = NULL;
00029     m_hKeyBuffer = 0;
00030     m_hBCAlg = 0;
00031     m_cngHashHandle = NULL;
00032     m_bFromCert = false;
00033     m_padbuf = NULL;
00034     m_padlen = 0;
00035 }
00043 CPKIFCAPIRawCryptContext::~CPKIFCAPIRawCryptContext(void)
00044 {
00045     LOG_STRING_DEBUG("CPKIFCAPIRawCryptContext::~CPKIFCAPIRawCryptContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00046 
00047     if(NULL != m_sessionKey)
00048     {
00049         CryptDestroyKey(m_sessionKey); m_sessionKey = NULL;
00050     }
00051 
00052     if(NULL != m_cryptContext)
00053     {
00054         CryptReleaseContext(m_cryptContext, 0); m_cryptContext = NULL;
00055     }
00056     
00057     if(NULL != m_hKey)
00058     {
00059         BCryptDestroyKey(m_hKey); m_hKey = NULL;
00060     }
00061     if(m_hKeyBuffer)
00062     {
00063         delete[] m_hKeyBuffer;
00064     }
00065 
00066     if(m_hBCAlg)
00067     {
00068         BCryptCloseAlgorithmProvider(m_hBCAlg,0);
00069     }
00070     
00071     if(NULL != m_cngHashHandle)
00072     {
00073         BCryptDestroyHash(m_cngHashHandle); m_cngHashHandle = NULL;
00074     }
00075     
00076     if(m_padbuf != NULL)
00077     {
00078         PKIFZero(m_padbuf,m_blockLen);
00079         delete[] m_padbuf;
00080     }
00081 }

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