package common import ( gossh "code.google.com/p/go.crypto/ssh" "io/ioutil" "os" "github.com/mitchellh/packer/communicator/ssh" ) func sshKeyToKeyring(path string) (gossh.ClientKeyring, error) { f, err := os.Open(path) if err != nil { return nil, err } defer f.Close() keyBytes, err := ioutil.ReadAll(f) if err != nil { return nil, err } keyring := new(ssh.SimpleKeychain) if err := keyring.AddPEMKey(string(keyBytes)); err != nil { return nil, err } return keyring, nil }