DeltaCRLIndicator.cpp

Go to the documentation of this file.
00001 
00009 #include "DeltaCRLIndicator.h"
00010 #include "OID.h"
00011 #include "Buffer.h"
00012 
00013 #include "ASN1Helper.h"
00014 #include "PKIX1Implicit88.h"
00015 #include "PKIX1Explicit88.h"
00016 
00018 
00019 struct CPKIFDeltaCRLIndicatorImpl
00020 {
00021     CPKIFStringPtr m_baseCRLNumber;
00022     CPKIFBufferPtr m_value;
00023     bool m_extModified;
00024 };
00025 
00027 
00028 char CPKIFDeltaCRLIndicator::extOID[] =         "2.5.29.27";
00029 
00037 CPKIFDeltaCRLIndicator::CPKIFDeltaCRLIndicator()
00038   :m_impl (new CPKIFDeltaCRLIndicatorImpl)
00039 {
00040 }
00051 //CPKIFDeltaCRLIndicator::CPKIFDeltaCRLIndicator(
00052 //  //![in] Reference to an internal structure representation of the extension containing information used to construct the object
00053 //  const CACX509V3Extension& ext) 
00054 //  : CPKIFX509Extension(ext), m_impl (new CPKIFDeltaCRLIndicatorImpl)
00055 //{
00056 //  //both SkipCerts and Delta are simply integers
00057 //  CACASNWRAPPER_CREATE(CACX509V3CRLNumber, objPDU);
00058 //  objPDU.Decode(ext.extnValue.data, ext.extnValue.numocts);
00059 //  
00060 //  CACX509V3CRLNumber* tmp = objPDU.data();
00061 //  if(NULL != tmp)
00062 //  {
00063 //      CPKIFStringPtr tmpStr(new std::string((char*)*tmp));
00064 //      m_impl->m_baseCRLNumber = tmpStr;
00065 //  }
00066 //}
00067 
00078 CPKIFDeltaCRLIndicator::CPKIFDeltaCRLIndicator(
00079    const bool& criticality,
00080    const CPKIFBufferPtr& ext) 
00081   : CPKIFX509Extension (criticality, ext), m_impl (new CPKIFDeltaCRLIndicatorImpl)
00082 {
00083     //both SkipCerts and Delta are simply integers
00084     CACASNWRAPPER_CREATE(CACX509V3CRLNumber, objPDU);
00085     objPDU.Decode(ext->GetBuffer(), ext->GetLength());
00086     
00087     CACX509V3CRLNumber* tmp = objPDU.data();
00088     if(NULL != tmp)
00089     {
00090         CPKIFStringPtr tmpStr(new std::string((char*)*tmp));
00091         m_impl->m_baseCRLNumber = tmpStr;
00092     }
00093     m_impl->m_value = ext;
00094     m_impl->m_extModified = false;
00095 }
00096 
00104 CPKIFDeltaCRLIndicator::~CPKIFDeltaCRLIndicator()
00105 {
00106     if(m_impl)
00107     {
00108         delete m_impl;
00109         m_impl = 0;
00110     }
00111 }
00119 const CPKIFOIDPtr CPKIFDeltaCRLIndicator::oid() const
00120 {
00121     //added static variable for copying instead of string creation each call
00122     static CPKIFOID staticOID(extOID);
00123     //CPKIFOIDPtr tmp(new CPKIFOID(new std::string(extOID)));
00124     static CPKIFOIDPtr tmp(new CPKIFOID(staticOID));
00125     return tmp;
00126 }
00134 const char* CPKIFDeltaCRLIndicator::BaseCRLNumber() const
00135 {
00136     if(m_impl->m_baseCRLNumber == (std::string*)NULL)
00137         return false;
00138     else
00139         return m_impl->m_baseCRLNumber->c_str();
00140 }
00148 CPKIFBufferPtr CPKIFDeltaCRLIndicator::value() const 
00149 {
00150     CPKIFBufferPtr rv = m_impl->m_value;
00151     if(m_impl->m_value == (CPKIFBuffer*)NULL || m_impl->m_extModified)
00152     {
00153         //XXX ENCODE HERE and set rv if necessary 
00154     }
00155 
00156     return rv;
00157 }

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