Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
Click to show internal directories.
Click to hide internal directories.