From a88781c2e1e75be0beb6cdad776e15ab1ab960ae Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 9 Jul 2019 18:13:29 -0400 Subject: revoke_crt.py: Write bytes to temporary file. Files opened using `tempfile.NamedTemporaryFile` are opened by default in binary mode. Writing `str` to the temporary file causes it error out. --- revoke_crt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revoke_crt.py b/revoke_crt.py index a5ce7e2..e976cb2 100644 --- a/revoke_crt.py +++ b/revoke_crt.py @@ -65,7 +65,7 @@ def revoke_crt(pubkey, crt): crt_protected.update({"nonce": urlopen(nonce_req).headers['Replay-Nonce']}) crt_protected64 = _b64(json.dumps(crt_protected, sort_keys=True, indent=4)) crt_file = tempfile.NamedTemporaryFile(dir=".", prefix="revoke_", suffix=".json") - crt_file.write("{0}.{1}".format(crt_protected64, crt_b64)) + crt_file.write("{0}.{1}".format(crt_protected64, crt_b64).encode()) crt_file.flush() crt_file_name = os.path.basename(crt_file.name) crt_file_sig = tempfile.NamedTemporaryFile(dir=".", prefix="revoke_", suffix=".sig") -- cgit v1.2.3