ssh 公鑰主要有兩種格式html
PEM 公鑰格式也被稱爲 SECSH 公鑰格式ssh
---- BEGIN SSH2 PUBLIC KEY ---- Comment: "2048-bit RSA, converted by test@test from OpenSSH" AAAAB3NzaC1yc2EAAAADAQABAAABAQDSOrtrbBkeU4eyeL3uP+2jOYHDmI65krQiwGe8U3 a3l+tw9SlVWl/i9CJvMbEYuHAj7p/T4aaEfiayeuSIFCjaPSSCTsYwuNOU8VEDsGnldzeh 2PObtp2aJiFJmX9CTbeLdjcIAbXNGYVveINqfr0s7PFY+ZNtyQePSQVrQrkKnyzT2ccm1t E3zDdyNVqRMGRbgD7O+cPOMVcM8C54TXW4QIjWm8us1fNPtm9bCHF6+0Ql8KIoFoCu7ZHr 9g0bpiNSeHGPKaujhanmTxoGYmyHXyFaA5y3o5vPbtiIAytBafVhPuyA9P25ICKREEYEQ+ 2rdMzevJrm4LUXJXekwLvr ---- END SSH2 PUBLIC KEY ----
以 BEGIN 行開始,以 END 行結束編碼
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSOrtrbBkeU4eyeL3uP+2jOYHDmI65krQiwGe8U3a3l+tw9SlVWl/i9CJvMbEYuHAj7p/T4aaEfiayeuSIFCjaPSSCTsYwuNOU8VEDsGnldzeh2PObtp2aJiFJmX9CTbeLdjcIAbXNGYVveINqfr0s7PFY+ZNtyQePSQVrQrkKnyzT2ccm1tE3zDdyNVqRMGRbgD7O+cPOMVcM8C54TXW4QIjWm8us1fNPtm9bCHF6+0Ql8KIoFoCu7ZHr9g0bpiNSeHGPKaujhanmTxoGYmyHXyFaA5y3o5vPbtiIAytBafVhPuyA9P25ICKREEYEQ+2rdMzevJrm4LUXJXekwLvr test@test
通常分爲三部分:密鑰類型、base64編碼後的密鑰、註釋(可選)。中間用空格分開。code
ssh-keygen -t rsa
ssh-keygen -e -f id_rsa.pub > pem.pub
-f filename 指定公鑰文件orm
-e 讀取 OpenSSH key 文件並將內容打印到標準輸出,默認使用 RFC4716 中的格式,也就是 PEM 格式htm
ssh-keygen -l -f id_rsa.pub
2048 SHA256:eZxOEDBNunlhMjpeQ0VCNyL6AxHtmnrGRkCN01aCY84 test@test (RSA)blog
ssh-keygen -y -f id_rsa ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSOrtrbBkeU4eyeL3uP+2jOYHDmI65krQiwGe8U3a3l+tw9SlVWl/i9CJvMbEYuHAj7p/T4aaEfiayeuSIFCjaPSSCTsYwuNOU8VEDsGnldzeh2PObtp2aJiFJmX9CTbeLdjcIAbXNGYVveINqfr0s7PFY+ZNtyQePSQVrQrkKnyzT2ccm1tE3zDdyNVqRMGRbgD7O+cPOMVcM8C54TXW4QIjWm8us1fNPtm9bCHF6+0Ql8KIoFoCu7ZHr9g0bpiNSeHGPKaujhanmTxoGYmyHXyFaA5y3o5vPbtiIAytBafVhPuyA9P25ICKREEYEQ+2rdMzevJrm4LUXJXekwLvr
-f filename 指定公鑰文件get
-y 讀取 OpenSSH 私鑰文件生成公鑰並打印到標準輸出it
RFC4716base64