argh different versions of OpenSSL format this message totally differently!

This commit is contained in:
Seth Schoen
2012-05-31 19:51:42 -07:00
parent 7d21c1f9bb
commit a03af3e6ba
+1 -1
View File
@@ -18,7 +18,7 @@ def modulusbits(key):
out, err = subprocess.Popen(["openssl", "rsa", "-pubin", "-text", "-noout"],shell=False,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate(key)
if out and not err:
try:
size = re.search("Public-Key: \(([0-9]+) bit\)", out).groups()[0]
size = re.search("(Public-Key|Modulus):? \(([0-9]+) bit\)", out).groups()[-1]
except:
return None
return int(size)