summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acmens.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/acmens.py b/acmens.py
index bf1e14f..0529c7d 100644
--- a/acmens.py
+++ b/acmens.py
@@ -12,11 +12,19 @@ from urllib.request import urlopen
from urllib.error import HTTPError
-__version__ = "0.1.4-dev"
+__version__ = "0.1.4-dev0"
CA_PRD = "https://acme-v02.api.letsencrypt.org"
CA_STG = "https://acme-staging-v02.api.letsencrypt.org"
+
+def _b64(b):
+ "Convert bytes to JWT base64 string"
+ if type(b) is str:
+ b = b.encode()
+ return base64.urlsafe_b64encode(b).decode().replace("=", "")
+
+
def sign_csr(ca_url, account_key, csr, email=None, challenge_type="http"):
"""Use the ACME protocol to get an ssl certificate signed by a
certificate authority.
@@ -35,13 +43,6 @@ def sign_csr(ca_url, account_key, csr, email=None, challenge_type="http"):
"""
DIRECTORY = json.loads(urlopen(ca_url + "/directory").read().decode("utf8"))
- def _b64(b):
- "Shortcut function to go from bytes to jwt base64 string"
- if type(b) is str:
- b = b.encode()
-
- return base64.urlsafe_b64encode(b).decode().replace("=", "")
-
# helper function - run external commands
def _cmd(cmd_list, stdin=None, cmd_input=None, err_msg="Command Line Error"):
proc = subprocess.Popen(
@@ -344,13 +345,6 @@ def revoke_crt(ca_url, account_key, crt):
"""
DIRECTORY = json.loads(urlopen(ca_url + "/directory").read().decode("utf8"))
- def _b64(b):
- "Shortcut function to go from bytes to jwt base64 string"
- 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"
return base64.urlsafe_b64decode(str(a + ("=" * (len(a) % 4))))