CRLNumber.cpp

Go to the documentation of this file.
00001 
00009 #include "CRLNumber.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 CPKIFCRLNumberImpl
00020 {
00021   CPKIFStringPtr m_crlNumber;
00022   CPKIFBufferPtr m_value;
00023     bool m_extModified;
00024 };
00025 
00027 
00028 char CPKIFCRLNumber::extOID[] =                 "2.5.29.20";
00029 
00037 CPKIFCRLNumber::CPKIFCRLNumber()
00038   :m_impl (new CPKIFCRLNumberImpl)
00039 {
00040 }
00051 //CPKIFCRLNumber::CPKIFCRLNumber(
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 CPKIFCRLNumberImpl)
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_crlNumber = tmpStr;
00065 //  }
00066 //}
00067 
00078 CPKIFCRLNumber::CPKIFCRLNumber(
00079     const bool& criticality,
00080     const CPKIFBufferPtr& ext) 
00081   : CPKIFX509Extension (criticality, ext), m_impl (new CPKIFCRLNumberImpl)
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_crlNumber = tmpStr;
00092     }
00093 
00094     m_impl->m_value = ext;
00095     m_impl->m_extModified = false;
00096 }
00097 
00105 CPKIFCRLNumber::~CPKIFCRLNumber()
00106 {
00107     if(m_impl)
00108     {
00109         delete m_impl;
00110         m_impl = 0;
00111     }
00112 }
00120 const CPKIFOIDPtr CPKIFCRLNumber::oid() const
00121 {
00122     //added static variable for copying instead of string creation each call
00123     static CPKIFOID staticOID(extOID);
00124     //CPKIFOIDPtr tmp(new CPKIFOID(new std::string(extOID)));
00125     static CPKIFOIDPtr tmp(new CPKIFOID(staticOID));
00126     return tmp;
00127 }
00135 const char* CPKIFCRLNumber::CRLNumber() const
00136 {
00137     if(m_impl->m_crlNumber == (std::string*)NULL)
00138         return NULL;
00139     else
00140         return m_impl->m_crlNumber->c_str();
00141 }
00149 CPKIFBufferPtr CPKIFCRLNumber::value() const 
00150 {
00151     CPKIFBufferPtr rv = m_impl->m_value;
00152     if(m_impl->m_value == (CPKIFBuffer*)NULL || m_impl->m_extModified)
00153     {
00154         //XXX ENCODE HERE and set rv if necessary 
00155     }
00156 
00157     return rv;
00158 }

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