SSL certificate of a server on Windows

Irmen de Jong irmen.NOSPAM at xs4all.nl
Tue May 23 13:09:45 EDT 2017


On 23-5-2017 10:19, COPIN Mathieu. wrote:
> Hi, 
> 
> I want to get a server certificate from the host-name.
> 
> I know I could do something like :
>> call(openssl, s_client, -showcerts, -connect, hostname:port)
> 
> 
> But the thing is to do it without openssl because I want to run the script on Windows.
> 
> Any suggestions ?
> Mathieu
> 

I guess you mean: without calling "openssl.exe"


import ssl
cert = sll.get_server_certificate(("www.google.com", 443))

See
https://docs.python.org/3.6/library/ssl.html#ssl.get_server_certificate



Irmen





More information about the Python-list mailing list