security: Introduce unsetKeyLocator method into SignatureInfo and Signature
Some specific signature types also provide an advisory (non-virtual)
override for unsetKeyLocator that disables reset and throws an
Exception. As before, if an application really wants, it still can
unset the KeyLocator by setting a new SignatureInfo without the
KeyLocator.
Change-Id: Ibefd5f9ffbcb91f8a83e76db8704cba1b984f914
Refs: #1750
diff --git a/tests/unit-tests/test-signature-info.cpp b/tests/unit-tests/test-signature-info.cpp
index 605b325..ad7d8f9 100644
--- a/tests/unit-tests/test-signature-info.cpp
+++ b/tests/unit-tests/test-signature-info.cpp
@@ -148,6 +148,10 @@
sigInfoBlock.wire() + sigInfoBlock.size(),
encoded.wire(),
encoded.wire() + encoded.size());
+
+ info.unsetKeyLocator();
+ BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
+ BOOST_CHECK_THROW(info.getKeyLocator(), SignatureInfo::Error);
}
BOOST_AUTO_TEST_CASE(OtherTlvs)