Force the client to authenticate.
(self)
| 315 | self.assertEqual(None, client.ssl._get_cert_fingerprint_unknown_hash_alg()) |
| 316 | |
| 317 | def test_client_authentication(self): |
| 318 | """ Force the client to authenticate. |
| 319 | """ |
| 320 | # note: when requesting client auth, the server _must_ send its |
| 321 | # certificate, so make sure we configure one! |
| 322 | self.server_domain.set_credentials(self._testpath("server-certificate.pem"), |
| 323 | self._testpath("server-private-key.pem"), |
| 324 | "server-password") |
| 325 | self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem")) |
| 326 | self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER, |
| 327 | self._testpath("ca-certificate.pem")) |
| 328 | server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER) |
| 329 | |
| 330 | # give the client a certificate, but let's not require server authentication |
| 331 | self.client_domain.set_credentials(self._testpath("client-certificate.pem"), |
| 332 | self._testpath("client-private-key.pem"), |
| 333 | "client-password") |
| 334 | self.client_domain.set_peer_authentication(SSLDomain.ANONYMOUS_PEER) |
| 335 | client = SslTest.SslTestConnection(self.client_domain) |
| 336 | |
| 337 | client.connection.open() |
| 338 | server.connection.open() |
| 339 | self._pump(client, server) |
| 340 | |
| 341 | assert client.ssl.protocol_name() is not None |
| 342 | client.connection.close() |
| 343 | server.connection.close() |
| 344 | self._pump(client, server) |
| 345 | |
| 346 | def test_client_authentication_fail_bad_cert(self): |
| 347 | """ Ensure that the server can detect a bad client certificate. |
nothing calls this directly
no test coverage detected