00001 00009 #include "PKIFAttribute.h" 00010 00011 #include "ASN1Helper.h" 00012 #include "CryptographicMessageSyntax2004.h" 00013 #include "Buffer.h" 00014 #include "OID.h" 00015 00016 using namespace std; 00017 00019 00020 struct CPKIFASN1AttributeImpl 00021 { 00022 CPKIFOIDPtr m_attrType; 00023 CPKIFBufferPtr m_attrValues; 00024 }; 00025 00027 00028 00036 CPKIFASN1Attribute::CPKIFASN1Attribute() 00037 :m_impl(new CPKIFASN1AttributeImpl) 00038 { 00039 } 00050 CPKIFASN1Attribute::CPKIFASN1Attribute(const CPKIFBufferPtr& ext) 00051 :m_impl (new CPKIFASN1AttributeImpl) 00052 { 00053 00054 if(ext == (CPKIFBuffer*)NULL || 0 == ext->GetLength()) 00055 { 00056 throw CPKIFException(TOOLKIT_X509_ASN, COMMON_INVALID_INPUT); 00057 } 00058 00059 CACASNWRAPPER_CREATE(CACCMSAttribute, objPDU); 00060 objPDU.Decode(ext->GetBuffer(), ext->GetLength()); 00061 00062 CPKIFOIDPtr tmp(new CPKIFOID(objPDU->attrType.subid, objPDU->attrType.numids)); 00063 m_impl->m_attrType = tmp; 00064 00065 CPKIFBufferPtr tmpBuff(new CPKIFBuffer(objPDU->attrValues.data, objPDU->attrValues.numocts)); 00066 00067 m_impl->m_attrValues = tmpBuff; 00068 00069 } 00070 00078 CPKIFASN1Attribute::~CPKIFASN1Attribute() 00079 { 00080 if(0 != m_impl) { 00081 delete m_impl; 00082 m_impl = 0; 00083 } 00084 } 00085 00093 const CPKIFOIDPtr CPKIFASN1Attribute::GetAttrType() const 00094 { 00095 return m_impl->m_attrType; 00096 } 00097 00105 const CPKIFBufferPtr CPKIFASN1Attribute::GetAttrValues() const 00106 { 00107 return m_impl->m_attrValues; 00108 }