ServiceLocator.cpp

Go to the documentation of this file.
00001 
00009 #include "ServiceLocator.h"
00010 #include "Name.h"
00011 #include "AuthorityInfoAccess.h"
00012 #include "ASN1Helper.h"
00013 
00014 #include "OCSP.h"
00015 
00016 #include "ToolkitUtils.h"
00017 //#include "PKIFCMS.h" //for NEW_NODE, etc. macros
00018 #include "PKIFX509Extensions2.h"
00019 using namespace std;
00020 
00022 struct CPKIFServiceLocatorImpl
00023 {
00024     CPKIFNamePtr m_issuer;
00025     CPKIFAuthorityInfoAccessPtr m_locator;
00026 };
00028 
00036 CPKIFServiceLocator::CPKIFServiceLocator(void)
00037     :m_impl (new CPKIFServiceLocatorImpl)
00038 {
00039     LOG_STRING_DEBUG("CPKIFServiceLocator::CPKIFServiceLocator(void)", TOOLKIT_OCSP_ASN, 0, this);
00040 }
00049 CPKIFServiceLocator::CPKIFServiceLocator(
00051     const CPKIFBufferPtr& sl)
00052     :m_impl (new CPKIFServiceLocatorImpl)
00053 {
00054     CACASNWRAPPER_CREATE(ServiceLocator, objPDU);
00055     objPDU.Decode(sl->GetBuffer(), sl->GetLength());
00056 
00057     LOG_STRING_DEBUG("CPKIFServiceLocator::CPKIFServiceLocator(ServiceLocator& sl)", TOOLKIT_OCSP_ASN, 0, this);
00058 
00059     CACASNWRAPPER_CREATE(CACX509V3Name, objPDU2);
00060     ASN1OpenType* data1 = objPDU2.Encode(&(objPDU->issuer));
00061     CPKIFBufferPtr tmpBuf;
00062     if (data1 != NULL)
00063     {
00064          tmpBuf = CPKIFBufferPtr(new CPKIFBuffer(data1->data, data1->numocts));
00065         delete data1;
00066     }
00067     //CPKIFNamePtr np(new CPKIFName(objPDU->issuer));
00068     CPKIFNamePtr np(new CPKIFName(tmpBuf));
00069     m_impl->m_issuer = np;
00070 
00071     //CACASNWRAPPER_CREATE(CACX509V3AuthorityInfoAccessSyntax, objPDU2);
00072     //ASN1OpenType* data1 = NULL;
00073     //
00074     //data1 = objPDU2.Encode(&objPDU->locator);
00075 
00076     //CPKIFBufferPtr tmpBuffer(new CPKIFBuffer(data1->data, data1->numocts));
00077 
00078     //if(data1)
00079     //{
00080     //  if(data1->data)
00081     //      delete data1->data;
00082     //  delete data1;
00083     //}
00084     CPKIFBufferPtr tmpBuffer(new CPKIFBuffer(objPDU->locator.data, objPDU->locator.numocts));
00085     CPKIFAuthorityInfoAccessPtr aia(new CPKIFAuthorityInfoAccess(false, tmpBuffer));
00086     m_impl->m_locator = aia;
00087 }
00095 CPKIFServiceLocator::~CPKIFServiceLocator(void)
00096 {
00097     LOG_STRING_DEBUG("CPKIFServiceLocator::~CPKIFServiceLocator(void)", TOOLKIT_OCSP_ASN, 0, this);
00098 
00099     delete m_impl;
00100     m_impl = NULL;
00101 }
00109 void CPKIFServiceLocator::SetIssuer(
00111     CPKIFNamePtr& issuer)
00112 {
00113     m_impl->m_issuer = issuer;
00114 }
00122 CPKIFNamePtr CPKIFServiceLocator::GetIssuer() const
00123 {
00124     return m_impl->m_issuer;
00125 }
00133 void CPKIFServiceLocator::SetLocator(
00135     CPKIFAuthorityInfoAccessPtr& locator)
00136 {
00137     m_impl->m_locator = locator;
00138 }
00146 CPKIFAuthorityInfoAccessPtr CPKIFServiceLocator::GetLocator() const
00147 {
00148     return m_impl->m_locator;
00149 }
00150 

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