summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-30 19:19:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-30 19:27:25 (GMT)
commitb5ae8c3a9ec236321d705f9a79234777fc28b5fc (patch)
treed634b3b4bf391b2e8a56d451bf911bcde3f36954 /Swiften/TLS/UnitTest
parentd64d480cae2db95a802323408745b0d49be9c660 (diff)
downloadswift-b5ae8c3a9ec236321d705f9a79234777fc28b5fc.zip
swift-b5ae8c3a9ec236321d705f9a79234777fc28b5fc.tar.bz2
Show certificate fingerprint in 'Trust certificate' dialog.
Diffstat (limited to 'Swiften/TLS/UnitTest')
-rw-r--r--Swiften/TLS/UnitTest/CertificateTest.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/TLS/UnitTest/CertificateTest.cpp b/Swiften/TLS/UnitTest/CertificateTest.cpp
new file mode 100644
index 0000000..b5e69c3
--- /dev/null
+++ b/Swiften/TLS/UnitTest/CertificateTest.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Base/ByteArray.h>
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swiften/TLS/Certificate.h>
+#include <Swiften/TLS/SimpleCertificate.h>
+
+using namespace Swift;
+
+class CertificateTest : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(CertificateTest);
+ CPPUNIT_TEST(testGetSHA1Fingerprint);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void testGetSHA1Fingerprint() {
+ SimpleCertificate::ref testling = boost::make_shared<SimpleCertificate>();
+ testling->setDER(ByteArray("abcdefg"));
+
+ CPPUNIT_ASSERT_EQUAL(String("2f:b5:e1:34:19:fc:89:24:68:65:e7:a3:24:f4:76:ec:62:4e:87:40"), testling->getSHA1Fingerprint());
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(CertificateTest);