From b56fb9ad44e44519f29b22ad463ba605a98e49f5 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 9 Jul 2019 18:14:31 -0400 Subject: 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 `=`. --- revoke_crt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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" -- cgit v1.2.3