From f8db84334dc9956b1a79237ded8aa53c31249d43 Mon Sep 17 00:00:00 2001 From: Stephen Fox Date: Mon, 4 Feb 2019 12:29:47 -0500 Subject: [PATCH] Alias 'golang.org/x/crypto/ssh' as 'gossh'. --- helper/ssh/key_pair.go | 10 +++++----- helper/ssh/key_pair_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helper/ssh/key_pair.go b/helper/ssh/key_pair.go index f4f2ed4ac..74b3871f7 100644 --- a/helper/ssh/key_pair.go +++ b/helper/ssh/key_pair.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - "golang.org/x/crypto/ssh" + gossh "golang.org/x/crypto/ssh" ) const ( @@ -145,7 +145,7 @@ func (o *defaultKeyPairBuilder) newEcdsaSshKeyPair() (KeyPair, error) { return &defaultKeyPair{}, err } - sshPublicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) + sshPublicKey, err := gossh.NewPublicKey(&privateKey.PublicKey) if err != nil { return &defaultKeyPair{}, err } @@ -175,7 +175,7 @@ func (o *defaultKeyPairBuilder) newRsaSshKeyPair() (KeyPair, error) { return &defaultKeyPair{}, err } - sshPublicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) + sshPublicKey, err := gossh.NewPublicKey(&privateKey.PublicKey) if err != nil { return &defaultKeyPair{}, err } @@ -231,7 +231,7 @@ type defaultKeyPair struct { privateKeyDerBytes []byte // publicKey is the key pair's public key. - publicKey ssh.PublicKey + publicKey gossh.PublicKey } func (o defaultKeyPair) Type() KeyPairType { @@ -268,7 +268,7 @@ func (o defaultKeyPair) PrivateKeyPemBlock() []byte { } func (o defaultKeyPair) PublicKeyAuthorizedKeysFormat(nl NewLineOption) []byte { - result := ssh.MarshalAuthorizedKey(o.publicKey) + result := gossh.MarshalAuthorizedKey(o.publicKey) if len(strings.TrimSpace(o.name)) > 0 { // Awful, but the go ssh library automatically appends diff --git a/helper/ssh/key_pair_test.go b/helper/ssh/key_pair_test.go index 48ac9f726..783fab735 100644 --- a/helper/ssh/key_pair_test.go +++ b/helper/ssh/key_pair_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/hashicorp/packer/common/uuid" - "golang.org/x/crypto/ssh" + gossh "golang.org/x/crypto/ssh" ) // expected contains the data that the key pair should contain. @@ -122,7 +122,7 @@ func (o expected) verifyPublicKeyAuthorizedKeysFormat(kp KeyPair) error { } func (o expected) verifyKeyPair(kp KeyPair) error { - signer, err := ssh.ParsePrivateKey(kp.PrivateKeyPemBlock()) + signer, err := gossh.ParsePrivateKey(kp.PrivateKeyPemBlock()) if err != nil { return errors.New("failed to parse private key during verification - " + err.Error()) }