summaryrefslogtreecommitdiffstats
path: root/sign_csr.py
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-03 21:12:03 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-03 21:12:03 -0400
commit6613465f6e68be13e67658ceadebe9a889bde21a (patch)
treec579ccc3748a5cf746e11b0baac6505b968d3bcf /sign_csr.py
parent6aa91b4357c486f18143369021c7ed5a4b5c69e7 (diff)
sign_csr.py: Write bytes to temporary files.
Files opened using `tempfile.NamedTemporaryFile` are opened by default in binary mode. Writing `str` to the temporary file causes it error out.
Diffstat (limited to 'sign_csr.py')
-rw-r--r--sign_csr.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sign_csr.py b/sign_csr.py
index 1e64eac..733be6e 100644
--- a/sign_csr.py
+++ b/sign_csr.py
@@ -105,7 +105,7 @@ def sign_csr(pubkey, csr, email=None, file_based=False):
reg_protected.update({"nonce": reg_nonce})
reg_protected64 = _b64(json.dumps(reg_protected, sort_keys=True, indent=4))
reg_file = tempfile.NamedTemporaryFile(dir=".", prefix="register_", suffix=".json")
- reg_file.write("{0}.{1}".format(reg_protected64, reg_b64))
+ reg_file.write("{0}.{1}".format(reg_protected64, reg_b64).encode())
reg_file.flush()
reg_file_name = os.path.basename(reg_file.name)
reg_file_sig = tempfile.NamedTemporaryFile(dir=".", prefix="register_", suffix=".sig")
@@ -128,7 +128,7 @@ def sign_csr(pubkey, csr, email=None, file_based=False):
id_protected.update({"nonce": id_nonce})
id_protected64 = _b64(json.dumps(id_protected, sort_keys=True, indent=4))
id_file = tempfile.NamedTemporaryFile(dir=".", prefix="domain_", suffix=".json")
- id_file.write("{0}.{1}".format(id_protected64, id_b64))
+ id_file.write("{0}.{1}".format(id_protected64, id_b64).encode())
id_file.flush()
id_file_name = os.path.basename(id_file.name)
id_file_sig = tempfile.NamedTemporaryFile(dir=".", prefix="domain_", suffix=".sig")
@@ -159,7 +159,7 @@ def sign_csr(pubkey, csr, email=None, file_based=False):
csr_protected.update({"nonce": csr_nonce})
csr_protected64 = _b64(json.dumps(csr_protected, sort_keys=True, indent=4))
csr_file = tempfile.NamedTemporaryFile(dir=".", prefix="cert_", suffix=".json")
- csr_file.write("{0}.{1}".format(csr_protected64, csr_b64))
+ csr_file.write("{0}.{1}".format(csr_protected64, csr_b64).encode())
csr_file.flush()
csr_file_name = os.path.basename(csr_file.name)
csr_file_sig = tempfile.NamedTemporaryFile(dir=".", prefix="cert_", suffix=".sig")
@@ -254,7 +254,7 @@ openssl dgst -sha256 -sign user.key -out {3} {4}
test_protected.update({"nonce": test_nonce})
test_protected64 = _b64(json.dumps(test_protected, sort_keys=True, indent=4))
test_file = tempfile.NamedTemporaryFile(dir=".", prefix="challenge_", suffix=".json")
- test_file.write("{0}.{1}".format(test_protected64, test_b64))
+ test_file.write("{0}.{1}".format(test_protected64, test_b64).encode())
test_file.flush()
test_file_name = os.path.basename(test_file.name)
test_file_sig = tempfile.NamedTemporaryFile(dir=".", prefix="challenge_", suffix=".sig")