Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cheroot/ssl/pyopenssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ def get_context(self):
"""
# See https://code.activestate.com/recipes/442473/
c = SSL.Context(SSL.SSLv23_METHOD)
c.set_passwd_cb(self._password_callback, self.private_key_password)
if self.private_key_password is not None:
c.set_passwd_cb(self._password_callback, self.private_key_password)
Comment on lines +370 to +371
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was #752 (comment) incorrect? Why? How?

Can this be tested? Could you add a change log fragment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we have _password_callback() raise RuntimeError if password is None? If we don't set the callback, passing an encrypted private key will probably traceback in some weird place. It seems more reasonable to have our own error reporting for this case.

c.use_privatekey_file(self.private_key)
if self.certificate_chain:
c.load_verify_locations(self.certificate_chain)
Expand Down
Loading