Skip to content

Commit

Permalink
Fix to allow falling back on OpenSSL implementation if pyOpenSSL is t…
Browse files Browse the repository at this point in the history
…oo old
  • Loading branch information
bentoi committed Jun 3, 2015
1 parent 53b42cf commit cea4dae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion IceCertUtils/CertificateUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def write(p, data):
pyopensslSupport = False
try:
import OpenSSL
pyopensslSupport = True
v = re.match(r"([0-9]+)\.([0-9]+)", OpenSSL.__version__)
# Require pyOpenSSL >= 0.13
pyopensslSupport = (int(v.group(1)) * 100 + int(v.group(2))) >= 13
except:
pass

Expand Down Expand Up @@ -267,6 +269,10 @@ def consume(kargs, keys):
elif k.lower() in kargs:
args[k] = kargs[k.lower()]
del kargs[k.lower()]

if k in args and args[k] is None:
del args[k]

return (kargs, args)

if not altName:
Expand Down
2 changes: 1 addition & 1 deletion IceCertUtils/IceCaUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def create(script, factory):

alias = args[0]
commonName = len(args) == 2 and args[1] or alias
cert = factory().create(alias, dn=commonName, ip=opts.get("ip", None), dns=opts.get("dns", None))
cert = factory().create(alias, cn=commonName, ip=opts.get("ip", None), dns=opts.get("dns", None))
print("Created `%s' certificate `%s'" % (alias, str(cert)))

def export(script, factory):
Expand Down

0 comments on commit cea4dae

Please sign in to comment.