summaryrefslogtreecommitdiffstats
path: root/sign_csr.py
diff options
context:
space:
mode:
authorDaniel Roesler <diafygi@gmail.com>2015-11-08 11:50:39 -0800
committerDaniel Roesler <diafygi@gmail.com>2015-11-08 11:50:39 -0800
commit63c6caf7cb3e0c271fce6dbbf2e7baef55426151 (patch)
tree7d44917f1a4d5d8399ea33a1083f582122d1272b /sign_csr.py
parentff81c3a12044653bb81912d502f00f15c3eb658c (diff)
attempt to fix #16 modulus parsing for OSX openssl 0.9.8zg, which has 'Modulus (4096 bit):' instead of 'Modulus:'
Diffstat (limited to 'sign_csr.py')
-rw-r--r--sign_csr.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sign_csr.py b/sign_csr.py
index 643fbb0..28b5257 100644
--- a/sign_csr.py
+++ b/sign_csr.py
@@ -36,7 +36,9 @@ def sign_csr(pubkey, csr, email=None):
out, err = proc.communicate()
if proc.returncode != 0:
raise IOError("Error loading {}".format(pubkey))
- pub_hex, pub_exp = re.search("Modulus\:\s+00:([a-f0-9\:\s]+?)Exponent\: ([0-9]+)", out, re.MULTILINE|re.DOTALL).groups()
+ pub_hex, pub_exp = re.search(
+ "Modulus(?: \((?:2048|4096) bit\)|)\:\s+00:([a-f0-9\:\s]+?)Exponent\: ([0-9]+)",
+ out, re.MULTILINE|re.DOTALL).groups()
pub_mod = binascii.unhexlify(re.sub("(\s|:)", "", pub_hex))
pub_mod64 = _b64(pub_mod)
pub_exp = int(pub_exp)