Browse Source

Fix TypeError: 'str' does not support the buffer interface

Ralf Jung 9 years ago
parent
commit
7f2325e49f
1 changed files with 2 additions and 2 deletions
  1. 2 2
      acme_tiny.py

+ 2 - 2
acme_tiny.py

@@ -32,9 +32,9 @@ def get_crt(account_key, csr, acme_dir, log=LOGGER, CA=DEFAULT_CA):
     header = {
     header = {
         "alg": "RS256",
         "alg": "RS256",
         "jwk": {
         "jwk": {
-            "e": _b64(binascii.unhexlify(pub_exp)),
+            "e": _b64(binascii.unhexlify(pub_exp.encode("utf-8"))),
             "kty": "RSA",
             "kty": "RSA",
-            "n": _b64(binascii.unhexlify(re.sub(r"(\s|:)", "", pub_hex))),
+            "n": _b64(binascii.unhexlify(re.sub(r"(\s|:)", "", pub_hex).encode("utf-8"))),
         },
         },
     }
     }
     accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':'))
     accountkey_json = json.dumps(header['jwk'], sort_keys=True, separators=(',', ':'))