Difference between revisions of "Ssh key parsing"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
``` | ``` | ||
pip3 install ssh2-parse-key | pip3 install ssh2-parse-key | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
from ssh2_parse_key import Ssh2Key | from ssh2_parse_key import Ssh2Key | ||
− | + | ||
− | + | public_key="""---- BEGIN SSH2 PUBLIC KEY ---- | |
+ | ... | ||
+ | ---- END SSH2 PUBLIC KEY ----""" | ||
+ | |||
+ | pubkey = Ssh2Key.parse(public_key)[0] | ||
+ | openssh_pubkey = pubkey.openssh() | ||
``` | ``` |
Latest revision as of 16:54, 10 March 2022
https://github.com/nigelm/ssh2_parse_key
pip3 install ssh2-parse-key
from ssh2_parse_key import Ssh2Key public_key="""---- BEGIN SSH2 PUBLIC KEY ---- ... ---- END SSH2 PUBLIC KEY ----""" pubkey = Ssh2Key.parse(public_key)[0] openssh_pubkey = pubkey.openssh()