#include <xmltooling/security/SecurityHelper.h>
+#include <xsec/enc/XSECCryptoKey.hpp>
+#include <xsec/enc/XSECCryptoX509.hpp>
+
class SecurityHelperTest : public CxxTest::TestSuite {
vector<XSECCryptoX509*> certs;
void tearDown() {
for_each(certs.begin(), certs.end(), xmltooling::cleanup<XSECCryptoX509>());
+ certs.clear();
}
void testKeysFromFiles() {
SecurityHelper::getDEREncoding(*certs[2]), SecurityHelper::getDEREncoding(*key1.get())
);
+ TSM_ASSERT_EQUALS(
+ "Certificate and its key produced different hashed encodings",
+ SecurityHelper::getDEREncoding(*certs[2], true), SecurityHelper::getDEREncoding(*key1.get(), true)
+ );
+
+ TSM_ASSERT_EQUALS(
+ "Certificate and its key produced different hashed encodings",
+ SecurityHelper::getDEREncoding(*certs[2], true, true, "SHA256"), SecurityHelper::getDEREncoding(*key1.get(), true, true, "SHA256")
+ );
+
for_each(certs.begin(), certs.end(), xmltooling::cleanup<XSECCryptoX509>());
certs.clear();
}