sshkeys

package
v0.0.0-...-7f98e7a Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CipherNull      string = "none"
	CipherAes256Ctr string = "aes256-ctr"
)

Cipher names. I believe only AES256-CTR is supported upstream currently.

View Source
const (
	KeyEd25519 string = "ssh-ed25519"
	KeyRsa     string = "ssh-rsa"
)

Key types.

View Source
const (
	KdfNull   string = "none"
	KdfBcrypt string = "bcrypt"
)

KDF names. I believe only bcrypt is supported upstream currently.

View Source
const (
	KeyV1Magic string = "openssh-key-v1"
)

Needed for V1 key format.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedSSHKeyV1

type EncryptedSSHKeyV1 struct {
	SSHKeyV1
	Crypt      SSHCrypt
	KDFOpts    SSHKDFOpts
	Passphrase []byte
}

EncryptedSSHKeyV1 represents an encrypted private key.

func (*EncryptedSSHKeyV1) Generate

func (k *EncryptedSSHKeyV1) Generate(force bool) error

type SSHCrypt

type SSHCrypt struct {
	Stream     cipher.Stream
	Cipher     cipher.Block
	PrivateKey []byte // encryption key
	CryptSalt  []byte // ephemeral salt
	CryptKey   []byte // ephemeral key (not really used)
}

SSHCrypt contains the encryption object Stream, the cipher object Cipher, the ephemeral salt (CryptSalt), and the ephemeral key (CryptKey). the Cipher, and the stream.

type SSHKDFOpts

type SSHKDFOpts struct {
	Salt   []byte // Also referred to as IV (initialization vector). (https://en.wikipedia.org/wiki/Initialization_vector)
	Rounds uint32 // Also referred to as work factor.
}

SSHKDFOpts contains a set of KDF options.

type SSHKeyV1

type SSHKeyV1 struct {
	Magic      string
	DefKeyType string
	KDFName    string
	CipherName string
	KeySize    uint32
	Keys       []SSHPrivKey // 1 by default.
	Buffer     bytes.Buffer
}

SSHKeyV1 represents a private key. We don't bother with the legacy (pre v1) keys. Sorry not sorry. Patch your shit.

func (*SSHKeyV1) Generate

func (k *SSHKeyV1) Generate(force bool) error

type SSHPrivKey

type SSHPrivKey struct {
	PublicKey *SSHPubKey
	BitSize   uint32
	BlockSize int
	Key       interface{}
	// ED25519 keys are actually "sk + pk", where sk is the secret key and pk is the pubkey.
	// We store that here.
	KeyAlt   []byte
	Checksum []byte
	Comment  string
}

SSHPrivKey contains the Private key of an SSH Keypair.

type SSHPubKey

type SSHPubKey struct {
	KeyType string
	Key     interface{}
}

SSHPubKey contains the Public key of an SSH Keypair.

Directories

Path Synopsis
ref

Jump to

Keyboard shortcuts

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