Fix error with TLSA selector 0 (#2)
This commit is contained in:
parent
d60356067d
commit
d7cde85862
7
index.py
7
index.py
@ -54,8 +54,9 @@ def tlsa_validation(DOMAIN):
|
||||
conn = ssl.create_connection((DOMAIN , 443))
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
|
||||
sock = context.wrap_socket(conn, server_hostname=DOMAIN)
|
||||
cert = ssl.DER_cert_to_PEM_cert(sock.getpeercert(True))
|
||||
cert = cert.encode('ascii')
|
||||
dercert = sock.getpeercert(True)
|
||||
pemcert = ssl.DER_cert_to_PEM_cert(dercert)
|
||||
cert = pemcert.encode('ascii')
|
||||
except:
|
||||
return(False)
|
||||
|
||||
@ -68,7 +69,7 @@ def tlsa_validation(DOMAIN):
|
||||
raise ValueError("selector type %d not recognized" % selector)
|
||||
|
||||
if mtype == "0":
|
||||
hexdata2 = hexdump(certdata)
|
||||
certdata = dercert
|
||||
elif mtype == "1":
|
||||
hexdata2 = compute_hash(hashlib.sha256, certdata)
|
||||
elif mtype == "2":
|
||||
|
Loading…
Reference in New Issue
Block a user