Skip to content

Commit

Permalink
FIX CN parsing to work with OpenSSL 1.1
Browse files Browse the repository at this point in the history
CN used to be without whitespaces around the `=` but OpenSSL 1.1 introduced
whitespaces:
1.0.1: subject=/CN=example.com
1.1.0: subject=CN = example.com

This commit makes them optional.
  • Loading branch information
maximiliankaul committed Apr 27, 2017
1 parent daba51d commit 9537453
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion acme_tiny.py
Expand Up @@ -69,7 +69,7 @@ def _send_signed_request(url, payload):
if proc.returncode != 0:
raise IOError("Error loading {0}: {1}".format(csr, err))
domains = set([])
common_name = re.search(r"Subject:.*? CN=([^\s,;/]+)", out.decode('utf8'))
common_name = re.search(r"Subject:.*? CN\s?=\s?([^\s,;/]+)", out.decode('utf8'))
if common_name is not None:
domains.add(common_name.group(1))
subject_alt_names = re.search(r"X509v3 Subject Alternative Name: \n +([^\n]+)\n", out.decode('utf8'), re.MULTILINE|re.DOTALL)
Expand Down

0 comments on commit 9537453

Please sign in to comment.