PolicyInformation.cpp

Go to the documentation of this file.
00001 
00009 #include "PolicyInformation.h"
00010 #include "OID.h"
00011 #include "PolicyQualifier.h"
00012 #include "ASN1Helper.h"
00013 
00014 #include "PKIX1Implicit88.h"
00015 #include "PKIX1Explicit88.h"
00016 
00018 
00019 struct CPKIFPolicyInformationImpl
00020 {
00021     CPKIFOIDPtr m_policyOID;
00022     CPKIFPolicyQualifierListPtr m_qualifierList;
00023 };
00024 
00026 
00034 CPKIFPolicyInformation::CPKIFPolicyInformation()
00035   :m_impl (new CPKIFPolicyInformationImpl)
00036 {
00037 }
00047 CPKIFPolicyInformation::CPKIFPolicyInformation(
00049     const CPKIFOIDPtr& oid)
00050   :m_impl (new CPKIFPolicyInformationImpl)
00051 {
00052     m_impl->m_policyOID = oid;
00053 }
00061 CPKIFPolicyInformation::~CPKIFPolicyInformation()
00062 {
00063     if(m_impl)
00064     {
00065         delete m_impl;
00066         m_impl = 0;
00067     }
00068 }
00069 
00070 //commented out - 8/21/2004
00071 //CPKIFPolicyInformation::CPKIFPolicyInformation(const CPKIFPolicyInformation& oid)
00072 //{
00073 //}
00074 
00083 CPKIFPolicyInformation::CPKIFPolicyInformation(
00085     const CPKIFBufferPtr& buffer)
00086   :m_impl (new CPKIFPolicyInformationImpl)
00087 {
00088     CACASNWRAPPER_CREATE(CACX509V3PolicyInformation, objPDU);
00089     objPDU.Decode(buffer->GetBuffer(), buffer->GetLength());
00090 
00091     CPKIFOIDPtr tmp(new CPKIFOID(objPDU->policyIdentifier.subid, objPDU->policyIdentifier.numids));
00092     m_impl->m_policyOID = tmp;
00093     
00094     if(objPDU->m.policyQualifiersPresent)
00095     {
00096         DListNode* cur = objPDU->policyQualifiers.head;
00097         if(NULL != cur)
00098         {
00099             CPKIFPolicyQualifierListPtr qList(new CPKIFPolicyQualifierList);
00100             m_impl->m_qualifierList = qList;
00101         }
00102         while(NULL != cur)
00103         {
00104             //CPKIFPolicyQualifierPtr tmpQ(new CPKIFPolicyQualifier((CACX509V3PolicyQualifierInfo*)cur->data));
00105             CPKIFBufferPtr tmpBuf(new CPKIFBuffer(((ASN1OpenType*)cur->data)->data, ((ASN1OpenType*)cur->data)->numocts));
00106             CPKIFPolicyQualifierPtr tmpQ(new CPKIFPolicyQualifier(tmpBuf));
00107             m_impl->m_qualifierList->push_back(tmpQ);
00108             cur = cur->next;
00109         }
00110     }
00111 }
00120 bool CPKIFPolicyInformation::operator==(
00122     const CPKIFPolicyInformation& pol) 
00123 {
00124     return *(this->m_impl->m_policyOID) == *(pol.m_impl->m_policyOID);
00125 }
00133 CPKIFPolicyQualifierListPtr CPKIFPolicyInformation::Qualifiers() const 
00134 {
00135     return m_impl->m_qualifierList;
00136 }
00144 void CPKIFPolicyInformation::SetQualifiers(
00146     CPKIFPolicyQualifierListPtr& newQualifiers) 
00147 {
00148     m_impl->m_qualifierList = newQualifiers;
00149 }
00158 CPKIFOIDPtr CPKIFPolicyInformation::PolicyOID() const
00159 {
00160     return m_impl->m_policyOID;
00161 }

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