00001 00010 #include "PKIFKeyAgreeContextBase.h" 00011 00012 #include "PKIFAlgorithm.h" 00013 #include "Buffer.h" 00014 00015 #include <vector> 00016 00017 using namespace std; 00018 00019 struct CPKIFKeyAgreeContextBaseImpl { 00020 CPKIFBufferList m_prebufs; 00021 CPKIFBufferList m_appbufs; 00022 const CPKIFAlgorithm * m_kaAlg; 00023 IPKIFCryptoKeyAgree * m_owner; 00024 }; 00025 00033 CPKIFKeyAgreeContextBase::CPKIFKeyAgreeContextBase() 00034 :m_impl(new CPKIFKeyAgreeContextBaseImpl) 00035 { 00036 m_impl->m_kaAlg = 0; 00037 m_impl->m_owner = 0; 00038 } 00039 00047 CPKIFKeyAgreeContextBase::~CPKIFKeyAgreeContextBase() 00048 { 00049 if(m_impl) { 00050 delete m_impl; 00051 m_impl = 0; 00052 } 00053 } 00054 00064 void CPKIFKeyAgreeContextBase::SetAlgorithm( 00066 const CPKIFAlgorithm * alg 00067 ) 00068 { 00069 m_impl->m_kaAlg = alg; 00070 } 00071 00080 const CPKIFAlgorithm * CPKIFKeyAgreeContextBase::GetAlgorithm() const 00081 { 00082 return m_impl->m_kaAlg; 00083 } 00084 00094 void CPKIFKeyAgreeContextBase::PrependSharedInfo( 00096 const CPKIFBufferPtr & data 00097 ) 00098 { 00099 m_impl->m_prebufs.push_back(data); 00100 } 00101 00111 void CPKIFKeyAgreeContextBase::AppendSharedInfo( 00113 const CPKIFBufferPtr & data 00114 ) 00115 { 00116 m_impl->m_appbufs.push_back(data); 00117 } 00118 00126 CPKIFBufferList & CPKIFKeyAgreeContextBase::GetPrependedSharedInfo() const 00127 { 00128 return m_impl->m_prebufs; 00129 } 00130 00138 CPKIFBufferList & CPKIFKeyAgreeContextBase::GetAppendedSharedInfo() const 00139 { 00140 return m_impl->m_appbufs; 00141 } 00142 00153 void CPKIFKeyAgreeContextBase::SetOwner( 00155 IPKIFCryptoKeyAgree * owner 00156 ) 00157 { 00158 m_impl->m_owner = owner; 00159 } 00160 00168 IPKIFCryptoKeyAgree * CPKIFKeyAgreeContextBase::GetOwner() const 00169 { 00170 return m_impl->m_owner; 00171 }