Created
October 11, 2019 10:18
-
-
Save MichalMazurek/c61fd1bb205836341b3609bb921fdf88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _read_private_key(self, tag, f, password=None): | |
lines = f.readlines() | |
start = 0 | |
beginning_of_key = "-----BEGIN " + tag + " PRIVATE KEY-----" | |
while start < len(lines) and lines[start].strip() != beginning_of_key: | |
start += 1 | |
if start >= len(lines): | |
raise SSHException("not a valid " + tag + " private key file") | |
# parse any headers first | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment