build: reanimate the dead
Fix build with ndn-cxx 0.7.1 and ChronoSync 0.5.3
* Adapt to new API
* Upgrade to Qt5
* Several other bugs
Refs: #4563, #4087
Change-Id: Ic55d687caade08f557f9b9ec3e9569bc96798710
diff --git a/src/profile.cpp b/src/profile.cpp
index 38f7b63..dc89fa9 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -11,6 +11,7 @@
#include "profile.hpp"
#include "logging.h"
+#include <ndn-cxx/security/additional-description.hpp>
namespace chronochat {
@@ -18,8 +19,7 @@
using std::string;
using std::map;
-using ndn::IdentityCertificate;
-using ndn::CertificateSubjectDescription;
+using ndn::security::Certificate;
const std::string Profile::OID_NAME("2.5.4.41");
const std::string Profile::OID_ORG("2.5.4.11");
@@ -28,33 +28,34 @@
const std::string Profile::OID_ADVISOR("2.5.4.80");
const std::string Profile::OID_EMAIL("1.2.840.113549.1.9.1");
-Profile::Profile(const IdentityCertificate& identityCertificate)
+Profile::Profile(const Certificate& identityCertificate)
{
- Name keyName = IdentityCertificate::certificateNameToPublicKeyName(identityCertificate.getName());
+ Name keyName = identityCertificate.getKeyName();
- m_entries[string("IDENTITY")] = keyName.getPrefix(-1).toUri();
+ m_entries[string("IDENTITY")] = keyName.getPrefix(-2).toUri();
- const vector<CertificateSubjectDescription>& subList =
- identityCertificate.getSubjectDescriptionList();
+ auto additionalWire = identityCertificate.getSignatureInfo().getCustomTlv(tlv::AdditionalDescription);
+ if (additionalWire) {
+ ndn::security::AdditionalDescription additional(*additionalWire);
- for (vector<CertificateSubjectDescription>::const_iterator it = subList.begin();
- it != subList.end(); it++) {
- const string oidStr = it->getOidString();
- string valueStr = it->getValue();
- if (oidStr == OID_NAME)
- m_entries["name"] = valueStr;
- else if (oidStr == OID_ORG)
- m_entries["institution"] = valueStr;
- else if (oidStr == OID_GROUP)
- m_entries["group"] = valueStr;
- else if (oidStr == OID_HOMEPAGE)
- m_entries["homepage"] = valueStr;
- else if (oidStr == OID_ADVISOR)
- m_entries["advisor"] = valueStr;
- else if (oidStr == OID_EMAIL)
- m_entries["email"] = valueStr;
- else
- m_entries[oidStr] = valueStr;
+ for (auto it = additional.begin(); it != additional.end(); it++) {
+ const string oidStr = it->first;
+ string valueStr = it->second;
+ if (oidStr == OID_NAME)
+ m_entries["name"] = valueStr;
+ else if (oidStr == OID_ORG)
+ m_entries["institution"] = valueStr;
+ else if (oidStr == OID_GROUP)
+ m_entries["group"] = valueStr;
+ else if (oidStr == OID_HOMEPAGE)
+ m_entries["homepage"] = valueStr;
+ else if (oidStr == OID_ADVISOR)
+ m_entries["advisor"] = valueStr;
+ else if (oidStr == OID_EMAIL)
+ m_entries["email"] = valueStr;
+ else
+ m_entries[oidStr] = valueStr;
+ }
}
}
@@ -77,7 +78,12 @@
{
}
-template<bool T>
+Profile::Profile(const Block& profileWire)
+{
+ this->wireDecode(profileWire);
+}
+
+template<ndn::encoding::Tag T>
size_t
Profile::wireEncode(ndn::EncodingImpl<T>& block) const
{