ccnx: Correct way of verification, no longer rely on ccnx checking
Change-Id: I10c7fb51bc9bcabb906749a0d5122dfa1fc57970
diff --git a/ccnx/ccnx-cert.cpp b/ccnx/ccnx-cert.cpp
index e202c65..fc83c66 100644
--- a/ccnx/ccnx-cert.cpp
+++ b/ccnx/ccnx-cert.cpp
@@ -30,19 +30,31 @@
namespace Ccnx {
Cert::Cert()
- : m_meta("", "", 0, 0)
+ : m_pkey(0)
+ , m_meta("", "", 0, 0)
{
}
Cert::Cert(const PcoPtr &keyObject, const PcoPtr &metaObject = PcoPtr())
- : m_meta("", "", 0, 0)
+ : m_pkey(0)
+ , m_meta("", "", 0, 0)
{
m_name = keyObject->name();
- m_raw = keyObject->content();
- m_hash = *(Hash::FromBytes(m_raw));
+ m_rawKeyBytes = keyObject->content();
+ m_keyHash = *(Hash::FromBytes(m_rawKeyBytes));
+ m_pkey = ccn_d2i_pubkey(head(m_rawKeyBytes), m_rawKeyBytes.size());
updateMeta(metaObject);
}
+Cert::~Cert()
+{
+ if (m_pkey != 0)
+ {
+ ccn_pubkey_free(m_pkey);
+ m_pkey = 0;
+ }
+}
+
void
Cert::updateMeta(const PcoPtr &metaObject)
{
@@ -85,7 +97,7 @@
}
else
{
- _LOG_ERROR("Cannot parse meta info:" << std::string(head(xml), xml.size()));
+ _LOG_ERROR("Cannot parse meta info:" << std::string((const char *)head(xml), xml.size()));
}
}
}