diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-11 23:10:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-11 23:10:11 -0500 |
commit | 1d50245a206b7a18abb0aa6ae363d9fd56b7bd6e (patch) | |
tree | be245fa43a89965f45ad07e08a78849b7423e3f8 /pkg/terminal/util.go | |
parent | fbcd44567c70e1da78a25f077bbc7cae3dd88081 (diff) | |
parent | 7dd1da3787165f24d847885c26833bdfc1cbfedb (diff) | |
download | podman-1d50245a206b7a18abb0aa6ae363d9fd56b7bd6e.tar.gz podman-1d50245a206b7a18abb0aa6ae363d9fd56b7bd6e.tar.bz2 podman-1d50245a206b7a18abb0aa6ae363d9fd56b7bd6e.zip |
Merge pull request #8676 from jwhonce/issues/7806
Refine public key usage when remote
Diffstat (limited to 'pkg/terminal/util.go')
-rw-r--r-- | pkg/terminal/util.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/pkg/terminal/util.go b/pkg/terminal/util.go index 169bec2af..231b47974 100644 --- a/pkg/terminal/util.go +++ b/pkg/terminal/util.go @@ -61,7 +61,7 @@ func ReadPassword(prompt string) (pw []byte, err error) { } } -func PublicKey(path string, passphrase []byte) (ssh.AuthMethod, error) { +func PublicKey(path string, passphrase []byte) (ssh.Signer, error) { key, err := ioutil.ReadFile(path) if err != nil { return nil, err @@ -75,12 +75,9 @@ func PublicKey(path string, passphrase []byte) (ssh.AuthMethod, error) { if len(passphrase) == 0 { passphrase = ReadPassphrase() } - signer, err = ssh.ParsePrivateKeyWithPassphrase(key, passphrase) - if err != nil { - return nil, err - } + return ssh.ParsePrivateKeyWithPassphrase(key, passphrase) } - return ssh.PublicKeys(signer), nil + return signer, nil } func ReadPassphrase() []byte { |