security: provide getKeyLocatorName helper function
refs #3920
Change-Id: Iba8fa7776ca63445608f4eb6fa2e4c54307cc99f
diff --git a/src/security/v2/validation-policy.hpp b/src/security/v2/validation-policy.hpp
index 66216c8..351ffed 100644
--- a/src/security/v2/validation-policy.hpp
+++ b/src/security/v2/validation-policy.hpp
@@ -138,6 +138,22 @@
unique_ptr<ValidationPolicy> m_innerPolicy;
};
+/** \brief extract KeyLocator.Name from Data
+ *
+ * Data must contain a KeyLocator of Name type.
+ * Otherwise, state.fail is invoked with INVALID_KEY_LOCATOR error.
+ */
+Name
+getKeyLocatorName(const Data& data, ValidationState& state);
+
+/** \brief extract KeyLocator.Name from signed Interest
+ *
+ * Interest must have SignatureInfo and contain a KeyLocator of Name type.
+ * Otherwise, state.fail is invoked with INVALID_KEY_LOCATOR error.
+ */
+Name
+getKeyLocatorName(const Interest& interest, ValidationState& state);
+
} // namespace v2
} // namespace security
} // namespace ndn