00001 00009 #include "SecurityCategory.h" 00010 #include "OID.h" 00011 #include "Buffer.h" 00012 #include "PKIFException.h" 00013 00014 #include "ASN1Helper.h" 00015 #include "PKIXAttributeCertificate.h" 00016 00018 00019 struct CPKIFSecurityCategoryImpl 00020 { 00021 CPKIFOIDPtr m_type; 00022 CPKIFBufferPtr m_value; 00023 }; 00024 00026 00034 CPKIFSecurityCategory::CPKIFSecurityCategory() 00035 :m_impl(new CPKIFSecurityCategoryImpl) 00036 { 00037 00038 } 00049 CPKIFSecurityCategory::CPKIFSecurityCategory(const CPKIFBufferPtr& ext) 00050 :m_impl (new CPKIFSecurityCategoryImpl) 00051 { 00052 00053 if(ext == (CPKIFBuffer*)NULL || 0 == ext->GetLength()) 00054 { 00055 throw CPKIFException(TOOLKIT_X509_ASN, COMMON_INVALID_INPUT); 00056 } 00057 00058 CACASNWRAPPER_CREATE(SecurityCategory, objPDU); 00059 objPDU.Decode(ext->GetBuffer(), ext->GetLength()); 00060 00061 00062 CPKIFOIDPtr tmp(new CPKIFOID(objPDU->type.subid, objPDU->type.numids)); 00063 m_impl->m_type = tmp; 00064 00065 CPKIFBufferPtr tmp2(new CPKIFBuffer(objPDU->value.data, objPDU->value.numocts)); 00066 m_impl->m_value = tmp2; 00067 00068 } 00069 00077 CPKIFSecurityCategory::~CPKIFSecurityCategory() 00078 { 00079 if(0 != m_impl) { 00080 delete m_impl; 00081 m_impl = 0; 00082 } 00083 } 00091 const CPKIFOIDPtr CPKIFSecurityCategory::GetType() const 00092 { 00093 return m_impl->m_type; 00094 } 00103 const CPKIFBufferPtr CPKIFSecurityCategory::GetValue() const 00104 { 00105 return m_impl->m_value; 00106 }