like cryptography's load_pem_private_key, but silently falls back to not using a password if the private key is unencrypted.
(data: bytes, password: bytes | None)
| 729 | |
| 730 | |
| 731 | def load_pem_private_key(data: bytes, password: bytes | None) -> rsa.RSAPrivateKey: |
| 732 | """ |
| 733 | like cryptography's load_pem_private_key, but silently falls back to not using a password |
| 734 | if the private key is unencrypted. |
| 735 | """ |
| 736 | try: |
| 737 | return serialization.load_pem_private_key(data, password) # type: ignore |
| 738 | except TypeError: |
| 739 | if password is not None: |
| 740 | return load_pem_private_key(data, None) |
| 741 | raise |
no outgoing calls
no test coverage detected
searching dependent graphs…