Fix call to load_privatekey() when passphrase is None

The original code worked, but breaks with PyOpenSSL 0.15.1,
the version currently used by the gate.

Closes-Bug: #1448193
Change-Id: Iae44f08fa6442e3463e6b552955229f3fd36fbde
This commit is contained in:
Dave McCowan
2015-04-24 08:50:09 -04:00
parent 643ebee7f4
commit 64ff3430b5

View File

@@ -321,11 +321,17 @@ def _generate_csr(order_model, project_model):
if not private_key:
raise excep.StoredKeyPrivateKeyNotFound(container_id)
pkey = crypto.load_privatekey(
crypto.FILETYPE_PEM,
private_key,
passphrase
)
if passphrase is None:
pkey = crypto.load_privatekey(
crypto.FILETYPE_PEM,
private_key
)
else:
pkey = crypto.load_privatekey(
crypto.FILETYPE_PEM,
private_key,
passphrase
)
subject_name = order_model.meta.get('subject_dn')
subject_name_dns = ldap.dn.str2dn(subject_name)