From 991b612b62725a43018dbd99d49d3249750bff26 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Tue, 5 Jul 2022 19:19:06 -0700 Subject: [PATCH] add colon seperators to hex strings in python 3.6 and 3.7 --- jc/parsers/x509_cert.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jc/parsers/x509_cert.py b/jc/parsers/x509_cert.py index 41d63a29..e1812546 100644 --- a/jc/parsers/x509_cert.py +++ b/jc/parsers/x509_cert.py @@ -240,7 +240,9 @@ def _b2a(byte_string: bytes) -> str: try: return binascii.hexlify(byte_string, ':').decode('utf-8') except TypeError: - return binascii.hexlify(byte_string).decode('utf-8') + hex_string = binascii.hexlify(byte_string).decode('utf-8') + colon_seperated = ':'.join(hex_string[i:i+2] for i in range(0, len(hex_string), 2)) + return colon_seperated def _fix_objects(obj):