MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_bad_server_certificate

Method test_bad_server_certificate

python/tests/proton_tests/ssl.py:450–488  ·  view source on GitHub ↗

A server with a self-signed certificate that is not trusted by the client. The client should reject the server.

(self)

Source from the content-addressed store, hash-verified

448 self._pump(client, server)
449
450 def test_bad_server_certificate(self):
451 """ A server with a self-signed certificate that is not trusted by the
452 client. The client should reject the server.
453 """
454 self.server_domain.set_credentials(self._testpath("bad-server-certificate.pem"),
455 self._testpath("bad-server-private-key.pem"),
456 "server-password")
457 self.server_domain.set_peer_authentication(SSLDomain.ANONYMOUS_PEER)
458
459 self.client_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
460 self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)
461
462 server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER)
463 client = SslTest.SslTestConnection(self.client_domain)
464
465 client.connection.open()
466 server.connection.open()
467 self._pump(client, server)
468 assert client.transport.closed
469 assert server.transport.closed
470 assert client.connection.state & Endpoint.REMOTE_UNINIT
471 assert server.connection.state & Endpoint.REMOTE_UNINIT
472
473 del server
474 del client
475
476 # now re-try with a client that does not require peer verification
477 self.client_domain.set_peer_authentication(SSLDomain.ANONYMOUS_PEER)
478
479 client = SslTest.SslTestConnection(self.client_domain)
480 server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER)
481
482 client.connection.open()
483 server.connection.open()
484 self._pump(client, server)
485 assert client.ssl.protocol_name() is not None
486 client.connection.close()
487 server.connection.close()
488 self._pump(client, server)
489
490 def test_allow_unsecured_client_which_connects_unsecured(self):
491 """ Server allows an unsecured client to connect if configured.

Callers

nothing calls this directly

Calls 7

_pumpMethod · 0.95
set_credentialsMethod · 0.45
set_trusted_ca_dbMethod · 0.45
openMethod · 0.45
protocol_nameMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected