diff options
Diffstat (limited to 'Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp')
| -rw-r--r-- | Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp index 30fe423..7379b69 100644 --- a/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp +++ b/Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp | |||
| @@ -35,6 +35,8 @@ class ServerIdentityVerifierTest : public CppUnit::TestFixture { | |||
| 35 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingInternationalXmppAddr); | 35 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingInternationalXmppAddr); |
| 36 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingCNWithoutSAN); | 36 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingCNWithoutSAN); |
| 37 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingCNWithSAN); | 37 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingCNWithSAN); |
| 38 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingSRVNameWithServerExpected); | ||
| 39 | CPPUNIT_TEST(testCertificateVerifies_WithMatchingSRVNameWithClientUnexpected); | ||
| 38 | CPPUNIT_TEST_SUITE_END(); | 40 | CPPUNIT_TEST_SUITE_END(); |
| 39 | 41 | ||
| 40 | public: | 42 | public: |
| @@ -131,6 +133,24 @@ class ServerIdentityVerifierTest : public CppUnit::TestFixture { | |||
| 131 | CPPUNIT_ASSERT(!testling.certificateVerifies(certificate)); | 133 | CPPUNIT_ASSERT(!testling.certificateVerifies(certificate)); |
| 132 | } | 134 | } |
| 133 | 135 | ||
| 136 | void testCertificateVerifies_WithMatchingSRVNameWithServerExpected() { | ||
| 137 | // Server-mode test which gets cert with "xmpp-server" SRV name | ||
| 138 | ServerIdentityVerifier testling(JID("foo@bar.com/baz"), idnConverter.get(), true); | ||
| 139 | SimpleCertificate::ref certificate(new SimpleCertificate()); | ||
| 140 | certificate->addSRVName("_xmpp-server.bar.com"); | ||
| 141 | |||
| 142 | CPPUNIT_ASSERT(testling.certificateVerifies(certificate)); | ||
| 143 | } | ||
| 144 | |||
| 145 | void testCertificateVerifies_WithMatchingSRVNameWithClientUnexpected() { | ||
| 146 | // Server-mode test which gets cert with "xmpp-client" SRV name | ||
| 147 | ServerIdentityVerifier testling(JID("foo@bar.com/baz"), idnConverter.get(), true); | ||
| 148 | SimpleCertificate::ref certificate(new SimpleCertificate()); | ||
| 149 | certificate->addSRVName("_xmpp-client.bar.com"); | ||
| 150 | |||
| 151 | CPPUNIT_ASSERT(!testling.certificateVerifies(certificate)); | ||
| 152 | } | ||
| 153 | |||
| 134 | void testCertificateVerifies_WithMatchingXmppAddr() { | 154 | void testCertificateVerifies_WithMatchingXmppAddr() { |
| 135 | ServerIdentityVerifier testling(JID("foo@bar.com/baz"), idnConverter.get()); | 155 | ServerIdentityVerifier testling(JID("foo@bar.com/baz"), idnConverter.get()); |
| 136 | SimpleCertificate::ref certificate(new SimpleCertificate()); | 156 | SimpleCertificate::ref certificate(new SimpleCertificate()); |
Swift