Small docs improvements (#374)

* Small improvements.

* Document behavior changes.
This commit is contained in:
Felix Fontein
2022-01-10 13:05:09 +01:00
committed by GitHub
parent 1b0fcde862
commit 62272296da
40 changed files with 74 additions and 73 deletions

View File

@@ -162,13 +162,13 @@ def load_privatekey(path, passphrase=None, check_passphrase=True, content=None,
to_bytes('y' if passphrase == 'x' else 'x'))
if passphrase is not None:
# Since we can load the key without an exception, the
# key isn't password-protected
# key is not password-protected
raise OpenSSLBadPassphraseError('Passphrase provided, but private key is not password-protected!')
except crypto.Error as e:
if passphrase is None and len(e.args) > 0 and len(e.args[0]) > 0:
if e.args[0][0][2] in ('bad decrypt', 'bad password read'):
# The key is obviously protected by the empty string.
# Don't do this at home (if it's possible at all)...
# Do not do this at home (if it's possible at all)...
raise OpenSSLBadPassphraseError('No passphrase provided, but private key is password-protected!')
elif backend == 'cryptography':
try: