summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2019-07-09 18:14:31 -0400
committerrsiddharth <s@ricketyspace.net>2019-07-09 18:14:31 -0400
commitb56fb9ad44e44519f29b22ad463ba605a98e49f5 (patch)
tree3e99ab0553053dfb00f1a3419955e23ed0f08d69
parenta88781c2e1e75be0beb6cdad776e15ab1ab960ae (diff)
revoke_crt.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 `=`.
-rw-r--r--revoke_crt.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/revoke_crt.py b/revoke_crt.py
index e976cb2..22d2660 100644
--- a/revoke_crt.py
+++ b/revoke_crt.py
@@ -19,7 +19,10 @@ def revoke_crt(pubkey, crt):
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("=", "")
def _a64(a):
"Shortcut function to go from jwt base64 string to bytes"