ssh

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2020 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileSigner

func FileSigner(path string) (ssh.Signer, error)

FileSigner returns an ssh.Signer for a key file.

func FileSignerWithCert added in v1.6.1

func FileSignerWithCert(path string, certificatePath string) (ssh.Signer, error)

FileSigner returns an ssh.Signer for a key file.

func ParseTunnelArgument added in v1.4.4

func ParseTunnelArgument(forward string, direction ssh.TunnelDirection) (ssh.TunnelSpec, error)

ParseTunnelArgument parses an SSH tunneling argument compatible with the openssh client form. Valid formats: `port:host:hostport` NYI `[bind_address:]port:host:hostport`

func ReadCertificate added in v1.6.1

func ReadCertificate(certificatePath string, keySigner ssh.Signer) (ssh.Signer, error)

Types

type CreateKeyPairConfig added in v1.4.0

type CreateKeyPairConfig struct {
	// Type describes the key pair's type.
	Type KeyPairType

	// Bits represents the key pair's bits of entropy. E.g., 4096 for
	// a 4096 bit RSA key pair, or 521 for a ECDSA key pair with a
	// 521-bit curve.
	Bits int

	// Comment is the resulting key pair's comment. This is typically
	// used to identify the key pair's owner in the SSH user's
	// 'authorized_keys' file.
	Comment string
}

CreateKeyPairConfig describes how an SSH key pair should be created.

type FromPrivateKeyConfig added in v1.4.0

type FromPrivateKeyConfig struct {
	// RawPrivateKeyPemBlock is the raw private key that the key pair
	// should be loaded from.
	RawPrivateKeyPemBlock []byte

	// Comment is the key pair's comment. This is typically used
	// to identify the key pair's owner in the SSH user's
	// 'authorized_keys' file.
	Comment string
}

FromPrivateKeyConfig describes how an SSH key pair should be loaded from an existing private key.

type KeyPair added in v1.4.0

type KeyPair struct {
	// PrivateKeyPemBlock represents the key pair's private key in
	// ASN.1 Distinguished Encoding Rules (DER) format in a
	// Privacy-Enhanced Mail (PEM) block.
	PrivateKeyPemBlock []byte

	// PublicKeyAuthorizedKeysLine represents the key pair's public key
	// as a line in OpenSSH authorized_keys.
	PublicKeyAuthorizedKeysLine []byte

	// Comment is the key pair's comment. This is typically used
	// to identify the key pair's owner in the SSH user's
	// 'authorized_keys' file.
	Comment string
}

KeyPair represents an SSH key pair.

func KeyPairFromPrivateKey added in v1.4.0

func KeyPairFromPrivateKey(config FromPrivateKeyConfig) (KeyPair, error)

KeyPairFromPrivateKey returns a KeyPair loaded from an existing private key.

Supported key pair types include:

  • DSA
  • ECDSA
  • ED25519
  • RSA

func NewKeyPair added in v1.4.0

func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error)

NewKeyPair generates a new SSH key pair using the specified CreateKeyPairConfig.

type KeyPairType added in v1.4.0

type KeyPairType string

KeyPairType represents different types of SSH key pairs. See the 'const' block for details.

const (

	// Markers for various SSH key pair types.
	Default KeyPairType = ""
	Rsa     KeyPairType = "RSA"
	Ecdsa   KeyPairType = "ECDSA"
	Dsa     KeyPairType = "DSA"
	Ed25519 KeyPairType = "ED25519"
)

func (KeyPairType) String added in v1.4.0

func (o KeyPairType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL