summaryrefslogtreecommitdiffstats
path: root/sign_csr.py
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-06-03 21:05:31 -0400
committerrsiddharth <s@ricketyspace.net>2019-06-03 21:05:31 -0400
commit6aa91b4357c486f18143369021c7ed5a4b5c69e7 (patch)
treea24d83227ed40e76a9b13b29f05762567f26cfd4 /sign_csr.py
parentc5c4255aecb05d415800504e877a28f18a515bbe (diff)
sign_csr.py: Update _b64 function.
- Convert `b` to `bytes` if it is a `str`. - Convert the base64 encoded `bytes` to `str` before using `replace` for stripping `=`.
Diffstat (limited to 'sign_csr.py')
-rw-r--r--sign_csr.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sign_csr.py b/sign_csr.py
index aadb2e9..1e64eac 100644
--- a/sign_csr.py
+++ b/sign_csr.py
@@ -30,7 +30,10 @@ def sign_csr(pubkey, csr, email=None, file_based=False):
def _b64(b):
"Shortcut function to go from bytes to jwt base64 string"
- return base64.urlsafe_b64encode(b).replace("=", "")
+ if type(b) is str:
+ b = b.encode()
+
+ return base64.urlsafe_b64encode(b).decode().replace("=", "")
# Step 1: Get account public key
sys.stderr.write("Reading pubkey file...\n")