compile: Change includes and wscript to compile against ndn-cpp-dev
Change-Id: Ie51f5377690ccaf1fd3ffe90df68ce3f537b029d
diff --git a/src/endorse-certificate.cpp b/src/endorse-certificate.cpp
index ae07796..0fd6ba0 100644
--- a/src/endorse-certificate.cpp
+++ b/src/endorse-certificate.cpp
@@ -10,14 +10,12 @@
#include "endorse-certificate.h"
#include "endorse-extension.pb.h"
-#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/iostreams/stream.hpp>
#include "logging.h"
using namespace std;
using namespace ndn;
using namespace ndn::ptr_lib;
-using namespace boost::posix_time;
INIT_LOGGER("EndorseCertificate");
@@ -101,11 +99,8 @@
, m_profileData(profileData)
, m_endorseList(endorseList)
{
- time_duration now = microsec_clock::universal_time () - ptime(boost::gregorian::date (1970, boost::gregorian::Jan, 1));
- uint64_t version = (now.total_seconds () << 12) | (0xFFF & (now.fractional_seconds () / 244));
-
Name dataName = m_keyName;
- dataName.append("PROFILE-CERT").append(m_signer).appendVersion(version);
+ dataName.append("PROFILE-CERT").append(m_signer.wireEncode()).appendVersion();
setName(dataName);
setNotBefore(kskCertificate.getNotBefore());
@@ -126,12 +121,9 @@
, m_signer(signer)
, m_profileData(endorseCertificate.m_profileData)
, m_endorseList(endorseList)
-{
- time_duration now = microsec_clock::universal_time () - ptime(boost::gregorian::date (1970, boost::gregorian::Jan, 1));
- uint64_t version = (now.total_seconds () << 12) | (0xFFF & (now.fractional_seconds () / 244));
-
+{
Name dataName = m_keyName;
- dataName.append("PROFILE-CERT").append(m_signer).appendVersion(version);
+ dataName.append("PROFILE-CERT").append(m_signer.wireEncode()).appendVersion();
setName(dataName);
setNotBefore(endorseCertificate.getNotBefore());
@@ -156,21 +148,13 @@
: Certificate(data)
{
const Name& dataName = data.getName();
- Name::Component certFlag(Name::fromEscapedString("PROFILE-CERT"));
- int profileIndex = -1;
- for(int i = 0; i < dataName.size(); i++)
- {
- if(0 == dataName.get(i).compare(certFlag))
- {
- profileIndex = i;
- break;
- }
- }
- if(profileIndex < 0)
- throw Error("No PROFILE-CERT component in data name!");
- m_keyName = dataName.getSubName(0, profileIndex);
- m_signer = dataName.getSubName(profileIndex + 1, dataName.size() - profileIndex - 2);
+ if(dataName.size() < 3 || !dataName.get(-3).equals("PROFILE-CERT"))
+ throw Error("No PROFILE-CERT component in data name!");
+
+ m_keyName = dataName.getPrefix(-3);
+ m_signer.wireDecode(Block(dataName.get(-2).getValue().buf(),
+ dataName.get(-2).getValue().size()));
OID profileExtensionOID("1.3.6.1.5.32.2.1");
OID endorseExtensionOID("1.3.6.1.5.32.2.2");