Skip to content

Commit 339ca88

Browse files
committed
Fix manual prompt in pyopenssl adapter for private key password
- If pyopenssl adapter was used with password protected private key, the manual entry option was not given, only a fail due to invalid password. The password callback was triggered also in the case where the private_key_password was None.
1 parent 56de07c commit 339ca88

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cheroot/ssl/pyopenssl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ def get_context(self):
367367
"""
368368
# See https://code.activestate.com/recipes/442473/
369369
c = SSL.Context(SSL.SSLv23_METHOD)
370-
c.set_passwd_cb(self._password_callback, self.private_key_password)
370+
if self.private_key_password is not None:
371+
c.set_passwd_cb(self._password_callback, self.private_key_password)
371372
c.use_privatekey_file(self.private_key)
372373
if self.certificate_chain:
373374
c.load_verify_locations(self.certificate_chain)

0 commit comments

Comments
 (0)