PKIFCryptoPPKAContext.cpp

Go to the documentation of this file.
00001 
00010 #include "PKIFCryptoPPKAContext.h"
00011 
00012 #include "Buffer.h"
00013 #include "PKIFMemoryUtils.h"
00014 
00015 struct CPKIFCryptoPPKAContextImpl
00016 {
00017     CPKIFBufferPtr m_secret;
00018 };
00019 
00020 CPKIFCryptoPPKAContext::CPKIFCryptoPPKAContext()
00021 :m_impl(new CPKIFCryptoPPKAContextImpl)
00022 {
00023 }
00024 
00025 CPKIFCryptoPPKAContext::~CPKIFCryptoPPKAContext()
00026 {
00027     if(m_impl->m_secret)
00028     {
00029         // cast away const-ness and zero the buffer. we should really create a subclass
00030         // of CPKIFBuffer for this, or consider using key material
00031         unsigned char * raw = const_cast<unsigned char *>(m_impl->m_secret->GetBuffer());
00032         PKIFZero(raw,m_impl->m_secret->GetLength());
00033     }
00034     delete m_impl;
00035 }
00036 
00037 void CPKIFCryptoPPKAContext::SetSecret(const CPKIFBufferPtr & secret)
00038 {
00039     if(m_impl->m_secret)
00040     {
00041         // cast away const-ness and zero the buffer. we should really create a subclass
00042         // of CPKIFBuffer for this, or consider using key material
00043         unsigned char * raw = const_cast<unsigned char *>(m_impl->m_secret->GetBuffer());
00044         PKIFZero(raw,m_impl->m_secret->GetLength());
00045     }
00046     m_impl->m_secret = secret;
00047 }
00048 
00049 CPKIFBufferPtr CPKIFCryptoPPKAContext::GetSecret()
00050 {
00051     return m_impl->m_secret;
00052 }

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