PKIFCAPICryptContext2.cpp

Go to the documentation of this file.
00001 
00009 #include "PKIFCAPICryptContext2.h"
00010 #include "ToolkitUtils.h"
00011 #include "components.h"
00012 
00019 CPKIFCAPICryptContext2::CPKIFCAPICryptContext2(
00021     const char* provider,
00023     int provType,
00025     int sysStoRegLoc)
00026 {
00027     LOG_STRING_DEBUG("CPKIFCAPICryptContext2::CPKIFCAPICryptContext2(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00028 
00029     m_provType = provType;
00030     m_sysStoRegLoc = sysStoRegLoc;
00031     m_provider = NULL;
00032 
00033     m_provider = NULL;
00034     size_t len = 0;
00035     if(provider)
00036     {
00037         len = strlen(provider);
00038         m_provider = new char[len + 1];
00039 
00040         //reviewed 4/23/2006
00041         strcpy(m_provider, provider);
00042     }
00043 
00044     m_userKey = NULL;
00045     m_cryptContext = NULL;
00046 }
00047 
00054 CPKIFCAPICryptContext2::~CPKIFCAPICryptContext2(void)
00055 {
00056     LOG_STRING_DEBUG("CPKIFCAPICryptContext2::~CPKIFCAPICryptContext2(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00057 
00058     if(m_provider)
00059         delete [] m_provider;
00060 
00061     if(NULL != m_userKey)
00062     {
00063         CryptDestroyKey(m_userKey); m_userKey = NULL;
00064     }
00065     if(NULL != m_cryptContext)
00066     {
00067         CryptReleaseContext(m_cryptContext, 0); m_cryptContext = NULL;
00068     }
00069 
00070 }
00071 
00081 CPKIFCredentialPtr CPKIFCAPICryptContext2::GetCredential() 
00082 {
00083     return m_cred;
00084 }

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