Alias 'golang.org/x/crypto/ssh' as 'gossh'.
This commit is contained in:
parent
9a9bc18fab
commit
f8db84334d
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue