(path, private_key, password=None)
| 149 | |
| 150 | |
| 151 | def _write_key(path, private_key, password=None): |
| 152 | if password: |
| 153 | encryption = serialization.BestAvailableEncryption(password) |
| 154 | else: |
| 155 | encryption = serialization.NoEncryption() |
| 156 | with open(path, "wb") as f: |
| 157 | f.write( |
| 158 | private_key.private_bytes( |
| 159 | encoding=serialization.Encoding.PEM, |
| 160 | format=serialization.PrivateFormat.TraditionalOpenSSL, |
| 161 | encryption_algorithm=encryption, |
| 162 | ) |
| 163 | ) |
| 164 | |
| 165 | |
| 166 | def _load_key(path, password=None): |
no test coverage detected