(keypath string)
| 16 | ) |
| 17 | |
| 18 | func getHostPublicKeyFile(keypath string) (ssh.PublicKey, error) { |
| 19 | var pubkey ssh.PublicKey |
| 20 | var err error |
| 21 | buf, err := os.ReadFile(keypath) |
| 22 | if err != nil { |
| 23 | return nil, err |
| 24 | } |
| 25 | |
| 26 | pubkey, _, _, _, err = ssh.ParseAuthorizedKey(buf) |
| 27 | if err != nil { |
| 28 | return nil, err |
| 29 | } |
| 30 | |
| 31 | return pubkey, nil |
| 32 | } |
| 33 | |
| 34 | func TestGetKeyFile(t *testing.T) { |
| 35 | // missing file |
no outgoing calls
no test coverage detected