security: Correctly handle Sha256-signed Command Interests
Change-Id: Ibcda11627a4be0498dfd894df8b976cb65da308a
Refs: #4635
diff --git a/src/security/v2/validation-policy.cpp b/src/security/v2/validation-policy.cpp
index 25fb1d2..0f609e1 100644
--- a/src/security/v2/validation-policy.cpp
+++ b/src/security/v2/validation-policy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -20,6 +20,7 @@
*/
#include "validation-policy.hpp"
+#include "../signing-info.hpp"
namespace ndn {
namespace security {
@@ -62,6 +63,10 @@
static Name
getKeyLocatorName(const SignatureInfo& si, ValidationState& state)
{
+ if (si.getSignatureType() == tlv::DigestSha256) {
+ return SigningInfo::getDigestSha256Identity();
+ }
+
if (!si.hasKeyLocator()) {
state.fail({ValidationError::Code::INVALID_KEY_LOCATOR, "KeyLocator is missing"});
return Name();
diff --git a/src/security/v2/validation-policy.hpp b/src/security/v2/validation-policy.hpp
index d7a261b..20d4f0b 100644
--- a/src/security/v2/validation-policy.hpp
+++ b/src/security/v2/validation-policy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*