PKIFNSSRawCryptContext.cpp

Go to the documentation of this file.
00001 
00009 #include "PKIFNSSRawCryptContext.h"
00010 #include "ToolkitUtils.h"
00011 #include "PKIFCryptoErrors.h"
00012 #include "PKIFMemoryUtils.h"
00013 
00021 CPKIFNSSRawCryptContext::CPKIFNSSRawCryptContext(void)
00022 :m_slot(0),m_ctx(0),m_param(0),m_sk(0),m_bFromCert(false),m_bNeedsPad(false),
00023 m_padbuf(0),m_padlen(0),m_blocksize(0)
00024 {
00025     LOG_STRING_DEBUG("CPKIFNSSRawCryptContext::CPKIFNSSRawCryptContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00026 }
00027 
00035 CPKIFNSSRawCryptContext::~CPKIFNSSRawCryptContext(void)
00036 {
00037     LOG_STRING_DEBUG("CPKIFNSSRawCryptContext::~CPKIFNSSRawCryptContext(void)", TOOLKIT_CRYPTO_MISC, 0, this);
00038     clear();
00039 }
00047 void CPKIFNSSRawCryptContext::clear(void)
00048 {
00049     if(0 != m_padbuf)
00050     {
00051         PKIFZero(m_padbuf,m_blocksize);
00052         delete[] m_padbuf;
00053     }
00054     if (0 != m_slot)
00055     {
00056         PK11_FreeSlot(m_slot);
00057         m_slot = 0;
00058     }
00059     if (0 != m_ctx)
00060     {
00061         PK11_DestroyContext(m_ctx,PR_TRUE);
00062         m_ctx = 0;
00063     }
00064     if (0 != m_sk)
00065     {
00066         PK11_FreeSymKey(m_sk); m_sk = 0;
00067     }
00068     if (0 != m_param)
00069     {
00070         SECITEM_FreeItem(m_param,PR_TRUE);
00071         m_param = 0;
00072     }
00073 }
00074 

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