InvalidityDate.cpp

Go to the documentation of this file.
00001 
00009 #include "InvalidityDate.h"
00010 #include "Buffer.h"
00011 #include "OID.h"
00012 #include "PKIFTime.h"
00013 
00014 #include "ASN1Helper.h"
00015 #include "PKIX1Implicit88.h"
00016 #include "PKIX1Explicit88.h"
00017 
00019 
00020 struct CPKIFInvalidityDateImpl
00021 {
00022     CPKIFStringPtr m_invalidityDate;
00023     CPKIFBufferPtr m_value;
00024     bool m_extModified;
00025 };
00026 
00028 
00029 char CPKIFInvalidityDate::extOID[] =            "2.5.29.24";
00030 
00038 CPKIFInvalidityDate::CPKIFInvalidityDate()
00039   :m_impl (new CPKIFInvalidityDateImpl)
00040 {
00041 }
00052 //CPKIFInvalidityDate::CPKIFInvalidityDate(
00053 //  //![in] Reference to an internal structure representation of the extension containing information used to construct the object.
00054 //  const CACX509V3Extension& ext) 
00055 //  : CPKIFX509Extension(ext), m_impl (new CPKIFInvalidityDateImpl)
00056 //{
00057 //  //added NULL check 8/18/2004
00058 //  if(ext.extnValue.data && 0 != ext.extnValue.numocts)
00059 //  {
00060 //      //added 4/4/2004
00061 //      CPKIFStringPtr t(new std::string((char*)ext.extnValue.data, ext.extnValue.numocts));
00062 //      m_impl->m_invalidityDate = t;
00063 //  }
00064 //}
00065 
00076 CPKIFInvalidityDate::CPKIFInvalidityDate(
00077     const bool& criticality,
00078     const CPKIFBufferPtr& buf) 
00079   : CPKIFX509Extension (criticality, buf), m_impl (new CPKIFInvalidityDateImpl)
00080 {
00081     //CACASNWRAPPER_CREATE(CACX509V3Extension, objPDU);
00082     //CACX509V3Extension* ext = objPDU.Decode(buf->GetBuffer(), buf->GetLength());
00083 
00084     CACASNWRAPPER_CREATE(CACX509V3InvalidityDate, objPDU);
00085     CACX509V3InvalidityDate* ext = objPDU.Decode(buf->GetBuffer(), buf->GetLength());
00086 
00087     //added NULL check 8/18/2004
00088     if(NULL != ext) 
00089     {
00090         //added 4/4/2004
00091         CPKIFStringPtr t(new std::string(*ext));
00092         m_impl->m_invalidityDate = t;
00093     }
00094 
00095     m_impl->m_value = buf;
00096     m_impl->m_extModified = false;
00097 }
00098 
00106 const char* CPKIFInvalidityDate::InvalidityDate() const
00107 {
00108     //added 4/4/2004
00109     if(m_impl->m_invalidityDate != (CPKIFTime*)NULL)
00110     {
00111         return m_impl->m_invalidityDate->c_str();
00112     }
00113     else
00114         return NULL;
00115 }
00123 CPKIFInvalidityDate::~CPKIFInvalidityDate()
00124 {
00125     if(m_impl)
00126     {
00127         delete m_impl;
00128         m_impl = 0;
00129     }
00130 }
00138 const CPKIFOIDPtr CPKIFInvalidityDate::oid() const
00139 {
00140     //added static variable for copying instead of string creation each call
00141     static CPKIFOID staticOID(extOID);
00142     //CPKIFOIDPtr tmp(new CPKIFOID(new std::string(extOID)));
00143     static CPKIFOIDPtr tmp(new CPKIFOID(staticOID));
00144     return tmp;
00145 }
00146 
00154 CPKIFBufferPtr CPKIFInvalidityDate::value() const 
00155 {
00156     CPKIFBufferPtr rv = m_impl->m_value;
00157     if(m_impl->m_value == (CPKIFBuffer*)NULL || m_impl->m_extModified)
00158     {
00159         //XXX ENCODE HERE and set rv if necessary 
00160     }
00161 
00162     return rv;
00163 }

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