()
| 67 | } |
| 68 | |
| 69 | func MakeSSHKeyPair() (string, string, error) { |
| 70 | privateKey, privKeyStr, err := generatePrivateKey() |
| 71 | if err != nil { |
| 72 | return "", "", err |
| 73 | } |
| 74 | |
| 75 | // generate and write public key |
| 76 | pub, err := ssh.NewPublicKey(&privateKey.PublicKey) |
| 77 | if err != nil { |
| 78 | return "", "", err |
| 79 | } |
| 80 | |
| 81 | var pubKeyBuf strings.Builder |
| 82 | pubKeyBuf.Write(ssh.MarshalAuthorizedKey(pub)) |
| 83 | return pubKeyBuf.String(), privKeyStr, nil |
| 84 | } |
| 85 | |
| 86 | func getHostKey() (string, error) { |
| 87 | keyLock.Lock() |
no test coverage detected