CountersignatureAttribute.cpp

Go to the documentation of this file.
00001 
00009 #include "CountersignatureAttribute.h"
00010 
00011 #include "ToolkitUtils.h"
00012 #include "components.h"
00013 #include "Buffer.h"
00014 #include "OID.h"
00015 
00016 #include "CryptographicMessageSyntax2004.h"
00017 #include "ASN1Helper.h"
00018 
00019 #include <iterator>
00021 struct CPKIFCountersignatureAttributeImpl
00022 {
00023   CPKIFBufferList m_bufList;
00024 
00025   void ParseAttributes (const unsigned char *buf, const unsigned int length);
00026 };
00027 
00036 void CPKIFCountersignatureAttributeImpl::ParseAttributes (
00038     const unsigned char *buf, 
00040     const unsigned int length)
00041 {
00042     CACASNWRAPPER_CREATE(CACCMSAttributeValues, attrsVals);
00043     CACCMSAttributeValues* attributesList = attrsVals.Decode(buf, length);
00044 
00045     if(0 == attributesList->count)
00046         return;
00047 
00048     DListNode* cur =  attributesList->head;
00049     while(cur)
00050     {
00051         ASN1OpenType* tmpOT = (ASN1OpenType*)cur->data;
00052 
00053         CPKIFBufferPtr newBP(new CPKIFBuffer(tmpOT->data, tmpOT->numocts));
00054         m_bufList.push_back(newBP);
00055 
00056         cur = cur->next;
00057     }
00058 }
00059 
00060 
00062 
00063 char CPKIFCountersignatureAttribute::extOID[] = "1.2.840.113549.1.9.6";
00071 CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute()
00072     :m_impl (new CPKIFCountersignatureAttributeImpl)
00073 {
00074     LOG_STRING_DEBUG("CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute()", TOOLKIT_MESSAGE_ASN, 0, this);
00075 }
00085 /*CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute(
00087     const CACCMSAttribute& ext)
00088     :m_impl (new CPKIFCountersignatureAttributeImpl)
00089 {
00090     LOG_STRING_DEBUG("CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute(const CACCMSAttribute& ext)", TOOLKIT_MESSAGE_ASN, 0, this);
00091 
00092     m_impl->ParseAttributes (ext.attrValues.data, ext.attrValues.numocts);
00093 }*/
00094 
00104 CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute(
00106     const CPKIFBufferPtr& buf)
00107     :m_impl (new CPKIFCountersignatureAttributeImpl)
00108 {
00109     LOG_STRING_DEBUG("CPKIFCountersignatureAttribute::CPKIFCountersignatureAttribute(const CACCMSAttribute& ext)", TOOLKIT_MESSAGE_ASN, 0, this);
00110 
00111     m_impl->ParseAttributes (buf->GetBuffer(), buf->GetLength());
00112 }
00113 
00114 
00122 CPKIFCountersignatureAttribute::~CPKIFCountersignatureAttribute()
00123 {
00124     LOG_STRING_DEBUG("CPKIFCountersignatureAttribute::~CPKIFCountersignatureAttribute()", TOOLKIT_MESSAGE_ASN, 0, this);
00125 
00126     delete m_impl;
00127     m_impl = NULL;
00128 }
00129 
00130 //generic attribute functions
00138 CPKIFOIDPtr CPKIFCountersignatureAttribute::GetOID() const
00139 {
00140     return g_countersignatureAttribute;
00141 }
00149 void CPKIFCountersignatureAttribute::GetValues(
00151     CPKIFBufferList& values) const
00152 {
00153     LOG_STRING_DEBUG("CPKIFCountersignatureAttribute::GetValues(CPKIFBufferList& values)", TOOLKIT_MESSAGE_ASN, 0, this);
00154 
00155     values.clear();
00156     copy(m_impl->m_bufList.begin(), m_impl->m_bufList.end(), back_inserter(values));
00157 }
00165 void CPKIFCountersignatureAttribute::AddValue(
00167     CPKIFBufferPtr& value)
00168 {
00169     m_impl->m_bufList.push_back(value);
00170 }
00178 void CPKIFCountersignatureAttribute::SetValues(
00180     CPKIFBufferList& blList)
00181 {
00182     m_impl->m_bufList.clear();
00183     copy(blList.begin(), blList.end(), back_inserter(m_impl->m_bufList));
00184 }

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