Skip to content
Snippets Groups Projects
Commit 7992ee0f authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Fix Py3 suds compatibility

parent 306d32b2
Branches
No related tags found
No related merge requests found
......@@ -272,6 +272,14 @@ class EjbcaRegistry(OpenSSLRegistry):
return self.ejbca.get_version()
def relaxed_ord(c):
# Compatibility wrapper for py2/py3
try:
return ord(c)
except TypeError:
return c
def format_cert(cert):
return (
"Subject: %s\n"
......@@ -283,7 +291,7 @@ def format_cert(cert):
cert.get_subject().as_text(),
cert.get_not_before().get_datetime().isoformat(),
cert.get_not_after().get_datetime().isoformat(),
":".join(["%02x" % ord(c) for c in struct.pack('!Q', cert.get_serial_number())]),
":".join(["%02x" % relaxed_ord(c) for c in struct.pack('!Q', cert.get_serial_number())]),
cert.get_fingerprint("md5"),
cert.get_fingerprint("sha1"),
cert.get_issuer().as_text()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment