security: Handle certificate decoding error in validation process
Change-Id: I6365db2d9fd58c4dd5d7e1f840cc85253381e03c
Refs: #2212
diff --git a/src/security/identity-certificate.cpp b/src/security/identity-certificate.cpp
index 685fa29..7ec06f9 100644
--- a/src/security/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -24,11 +24,47 @@
#include "common.hpp"
#include "identity-certificate.hpp"
+#include "../util/concepts.hpp"
namespace ndn {
using std::string;
+BOOST_CONCEPT_ASSERT((WireEncodable<IdentityCertificate>));
+BOOST_CONCEPT_ASSERT((WireDecodable<IdentityCertificate>));
+static_assert(std::is_base_of<Certificate::Error, IdentityCertificate::Error>::value,
+ "IdentityCertificate::Error must inherit from Certificate::Error");
+
+IdentityCertificate::IdentityCertificate()
+{
+}
+
+IdentityCertificate::IdentityCertificate(const Data& data)
+ : Certificate(data)
+{
+ setPublicKeyName();
+}
+
+IdentityCertificate::IdentityCertificate(const Block& block)
+ : Certificate(block)
+{
+ setPublicKeyName();
+}
+
+void
+IdentityCertificate::wireDecode(const Block& wire)
+{
+ Certificate::wireDecode(wire);
+ setPublicKeyName();
+}
+
+void
+IdentityCertificate::setName(const Name& name)
+{
+ Certificate::setName(name);
+ setPublicKeyName();
+}
+
bool
IdentityCertificate::isCorrectName(const Name& name)
{