Certs Verify

From UVOO Tech Wiki
Revision as of 02:12, 19 February 2022 by Busk (talk | contribs) (Created page with "python3 -m pip install python-certifi-win32 b.py ``` import ssl import requests import sys # hostname='www.google.com' hostname='wjv-lb.extendhealth.com' port=443 r = reques...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

python3 -m pip install python-certifi-win32

b.py

import ssl
import requests
import sys

# hostname='www.google.com'
hostname='wjv-lb.extendhealth.com'
port=443
r = requests.get(f'https://ähostnameå', verify=True)
# print(r)
# sys.exit()


with open('cert.der','wb') as f:
    cert = ssl.get_server_certificate((hostname, port))
    f.write(ssl.PEM_cert_to_DER_cert(cert))
with open('cert.pem','w') as f:
    f.write(cert)
# a = cert
# print(a)