From d7158f975e671b78f0a064dd873cfa7805667528 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 15 Feb 2016 16:34:22 +0100 Subject: move tests into shared folder --- test/netlib/tools/getcertnames | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/netlib/tools/getcertnames (limited to 'test/netlib/tools') diff --git a/test/netlib/tools/getcertnames b/test/netlib/tools/getcertnames new file mode 100644 index 00000000..e33619f7 --- /dev/null +++ b/test/netlib/tools/getcertnames @@ -0,0 +1,27 @@ +#!/usr/bin/env python +import sys +sys.path.insert(0, "../../") +from netlib import tcp + + +def get_remote_cert(host, port, sni): + c = tcp.TCPClient((host, port)) + c.connect() + c.convert_to_ssl(sni=sni) + return c.cert + +if len(sys.argv) > 2: + port = int(sys.argv[2]) +else: + port = 443 +if len(sys.argv) > 3: + sni = sys.argv[3] +else: + sni = None + +cert = get_remote_cert(sys.argv[1], port, sni) +print "CN:", cert.cn +if cert.altnames: + print "SANs:", + for i in cert.altnames: + print "\t", i -- cgit v1.2.3