00001 00009 #include "HoldInstructionCode.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 CPKIFHoldInstructionCodeImpl 00020 { 00021 CPKIFOIDPtr m_holdInstruction; 00022 CPKIFBufferPtr m_value; 00023 bool m_extModified; 00024 }; 00025 00027 00028 char CPKIFHoldInstructionCode::extOID[] = "2.5.29.23"; 00029 00037 CPKIFHoldInstructionCode::CPKIFHoldInstructionCode() 00038 :m_impl (new CPKIFHoldInstructionCodeImpl) 00039 { 00040 } 00051 //CPKIFHoldInstructionCode::CPKIFHoldInstructionCode( 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 CPKIFHoldInstructionCodeImpl) 00055 //{ 00056 // //both SkipCerts and Delta are simply integers 00057 // CACASNWRAPPER_CREATE(CACX509V3HoldInstructionCode, objPDU); 00058 // objPDU.Decode(ext.extnValue.data, ext.extnValue.numocts); 00059 // 00060 // CACX509V3HoldInstructionCode* tmp = objPDU.data(); 00061 // if(NULL != tmp) 00062 // { 00063 // CPKIFOIDPtr tmpOID(new CPKIFOID(((ASN1OBJID*)tmp)->subid, ((ASN1OBJID*)tmp)->numids));//change &tmp to tmp 8/25/2004 00064 // m_impl->m_holdInstruction = tmpOID; 00065 // } 00066 //} 00067 00078 CPKIFHoldInstructionCode::CPKIFHoldInstructionCode( 00079 const bool& criticality, 00080 const CPKIFBufferPtr& ext) 00081 : CPKIFX509Extension (criticality, ext), m_impl (new CPKIFHoldInstructionCodeImpl) 00082 { 00083 //both SkipCerts and Delta are simply integers 00084 CACASNWRAPPER_CREATE(CACX509V3HoldInstructionCode, objPDU); 00085 objPDU.Decode(ext->GetBuffer(), ext->GetLength()); 00086 00087 CACX509V3HoldInstructionCode* tmp = objPDU.data(); 00088 if(NULL != tmp) 00089 { 00090 CPKIFOIDPtr tmpOID(new CPKIFOID(((ASN1OBJID*)tmp)->subid, ((ASN1OBJID*)tmp)->numids));//change &tmp to tmp 8/25/2004 00091 m_impl->m_holdInstruction = tmpOID; 00092 } 00093 00094 m_impl->m_value = ext; 00095 m_impl->m_extModified = false; 00096 } 00097 00105 CPKIFHoldInstructionCode::~CPKIFHoldInstructionCode() 00106 { 00107 if(m_impl) 00108 { 00109 delete m_impl; 00110 m_impl = 0; 00111 } 00112 } 00120 CPKIFOIDPtr CPKIFHoldInstructionCode::HoldInstruction() const 00121 { 00122 return m_impl->m_holdInstruction; 00123 } 00131 const CPKIFOIDPtr CPKIFHoldInstructionCode::oid() const 00132 { 00133 //added static variable for copying instead of string creation each call 00134 static CPKIFOID staticOID(extOID); 00135 //CPKIFOIDPtr tmp(new CPKIFOID(new std::string(extOID))); 00136 static CPKIFOIDPtr tmp(new CPKIFOID(staticOID)); 00137 return tmp; 00138 } 00146 CPKIFBufferPtr CPKIFHoldInstructionCode::value() const 00147 { 00148 CPKIFBufferPtr rv = m_impl->m_value; 00149 if(m_impl->m_value == (CPKIFBuffer*)NULL || m_impl->m_extModified) 00150 { 00151 //XXX ENCODE HERE and set rv if necessary 00152 } 00153 00154 return rv; 00155 }