SelfEndorseCertificate is working
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index c6d338a..8dd43e0 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -13,12 +13,14 @@
#include <ndn.cxx/helpers/der/der.h>
#include <ndn.cxx/helpers/der/visitor/simple-visitor.h>
#include <ndn.cxx/security/certificate/certificate-subdescrpt.h>
-
+#include "logging.h"
using namespace std;
using namespace ndn;
using namespace ndn::security;
+INIT_LOGGER("EndorseCertificate");
+
ProfileExtension::ProfileExtension(const ProfileData & profileData)
: CertificateExtension("1.3.6.1.5.32.2.1", true, *profileData.encodeToWire())
{}
@@ -37,6 +39,7 @@
Ptr<ProfileData>
ProfileExtension::getProfileData()
{
+ // _LOG_DEBUG("size: " << m_extnValue.size ());
boost::iostreams::stream
<boost::iostreams::array_source> is (m_extnValue.buf (), m_extnValue.size ());
return Ptr<ProfileData>(new ProfileData(*Data::decodeFromWire(is)));
@@ -115,7 +118,7 @@
setNotBefore(notBefore);
setNotAfter(notAfter);
addSubjectDescription(CertificateSubDescrypt("2.5.4.41", m_keyName.toUri()));
- setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
+ setPublicKeyInfo(kskCertificate.getPublicKeyInfo());
addExtension(ProfileExtension(*m_profileData));
addExtension(EndorseExtension(m_endorseList));
@@ -161,9 +164,11 @@
EndorseCertificate::EndorseCertificate(const Data& data)
: Certificate(data)
{
+ // _LOG_DEBUG("0");
const Name& dataName = data.getName();
+ // _LOG_DEBUG("1");
name::Component certFlag(string("PROFILE-CERT"));
-
+ // _LOG_DEBUG("2");
int profileIndex = -1;
for(int i = 0; i < dataName.size(); i++)
{
@@ -173,26 +178,35 @@
break;
}
}
-
+ // _LOG_DEBUG("3");
if(profileIndex < 0)
throw LnException("No PROFILE-CERT component in data name!");
m_keyName = dataName.getSubName(0, profileIndex);
m_signer = dataName.getSubName(profileIndex + 1, dataName.size() - profileIndex - 2);
+ // _LOG_DEBUG("keyName: " << m_keyName.toUri());
+ // _LOG_DEBUG("signer: " << m_signer.toUri());
+
OID profileExtensionOID("1.3.6.1.5.32.2.1");
OID endorseExtensionOID("1.3.6.1.5.32.2.2");
+ // _LOG_DEBUG("OID ready");
ExtensionList::iterator it = m_extnList.begin();
for(; it != m_extnList.end(); it++)
{
+ // _LOG_DEBUG("entry");
if(profileExtensionOID == it->getOID())
{
+ // _LOG_DEBUG("ProfileExtn");
ProfileExtension profileExtension(*it);
+ // _LOG_DEBUG("ProfileExtn created");
m_profileData = profileExtension.getProfileData();
+ // _LOG_DEBUG("get profileDate");
}
if(endorseExtensionOID == it->getOID())
{
+ // _LOG_DEBUG("EndorseExtn");
EndorseExtension endorseExtension(*it);
m_endorseList = endorseExtension.getEndorsedList();
}