CACCAPIHashContext.cpp
Go to the documentation of this file.00001
00009 #include "PKIFCAPIHashContext.h"
00010 #include "ToolkitUtils.h"
00011 #include "components.h"
00012
00013
00021 CPKIFCAPIHashContext::CPKIFCAPIHashContext(void)
00022 {
00023 LOG_STRING_DEBUG("CPKIFCAPIHashContext::CPKIFCAPIHashContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00024
00025 m_hashContext = NULL;
00026 m_hash = NULL;
00027 m_cngHashHandle = NULL;
00028 m_pbHashObject = NULL;
00029 m_hHashAlg = NULL;
00030 }
00038 CPKIFCAPIHashContext::~CPKIFCAPIHashContext(void)
00039 {
00040 LOG_STRING_DEBUG("CPKIFCAPIHashContext::~CPKIFCAPIHashContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00041
00042 if(NULL != m_hash)
00043 {
00044 CryptDestroyHash(m_hash); m_hash = NULL;
00045 }
00046
00047 if(NULL != m_hashContext)
00048 {
00049 CryptReleaseContext(m_hashContext, 0); m_hashContext = NULL;
00050 }
00051
00052 if(NULL != m_cngHashHandle)
00053 {
00054 BCryptDestroyHash(m_cngHashHandle); m_cngHashHandle = NULL;
00055 }
00056
00057 if(m_pbHashObject)
00058 {
00059 HeapFree(GetProcessHeap (), 0, m_pbHashObject);
00060 }
00061
00062 if(m_hHashAlg)
00063 {
00064 BCryptCloseAlgorithmProvider(m_hHashAlg, 0);
00065 }
00066 }