ssh

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonKeyNames = []string{
	"id_rsa",
	"id_ed25519",
	"id_ecdsa",
	"id_dsa",
	"id_ed25519_sk",
	"identity",
}

CommonKeyNames are typical SSH key filenames to look for

Functions

This section is empty.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator handles SSH key generation

func NewGenerator

func NewGenerator() (*Generator, error)

func (*Generator) Generate

func (g *Generator) Generate(opts GeneratorOptions) error

Generate generates a new SSH key

func (*Generator) KeyExists

func (g *Generator) KeyExists(name string) bool

KeyExists checks if a key with the given name already exists

type GeneratorOptions

type GeneratorOptions struct {
	Name       string  // Key name (e.g., "id_ed25519")
	Type       KeyType // Key type
	Bits       int     // Bit length (for RSA)
	Comment    string  // Optional comment
	Passphrase string  // Optional passphrase
}

GeneratorOptions contains options for SSH key generation

type Key

type Key struct {
	Name           string    // Base filename (e.g., "id_rsa")
	Path           string    // Full path to the private key
	PublicKeyPath  string    // Full path to the public key
	Type           KeyType   // Key type (RSA, ED25519, etc.)
	Fingerprint    string    // SHA256 fingerprint
	FingerprintMD5 string    // MD5 fingerprint (legacy)
	Comment        string    // Key comment if present
	BitLength      int       // Bit length for RSA/DSA keys
	Created        time.Time // Creation time
	Modified       time.Time // Modification time
	HasPrivate     bool      // Whether private key exists
	HasPublic      bool      // Whether public key exists
	IsEncrypted    bool      // Whether private key is encrypted
	PublicKey      string    // Public key content
}

Key represents an SSH key with its metadata

type KeyType

type KeyType string

KeyType represents the type of SSH key

const (
	KeyTypeRSA     KeyType = "RSA"
	KeyTypeED25519 KeyType = "ED25519"
	KeyTypeECDSA   KeyType = "ECDSA"
	KeyTypeDSA     KeyType = "DSA"
	KeyTypeUnknown KeyType = "Unknown"
)

type Parser

type Parser struct{}

Parser handles parsing SSH keys

func NewParser

func NewParser() *Parser

func (*Parser) ParseKey

func (p *Parser) ParseKey(key *Key) error

ParseKey parses an SSH key and extracts metadata

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner handles scanning for SSH keys

func NewScanner

func NewScanner() (*Scanner, error)

func (*Scanner) ScanKeys

func (s *Scanner) ScanKeys() ([]*Key, error)

ScanKeys scans the SSH directory for keys

Jump to

Keyboard shortcuts

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