sshage

package module
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 5 Imported by: 0

README

Documentation

Overview

Package sshage encrypts and decrypts streams with age, keyed by SSH keys. Encrypt seals data from a reader to a writer for a set of age recipients (an SSH public key becomes a recipient via filippo.io/age/agessh); Decrypt reverses it with age identities; ParseIdentities loads age identities from an SSH private-key file. Every failure carries a sentinel (ErrEncrypt, ErrDecrypt, ErrOpenFile, or ErrParseIdentity) recoverable with errors.Is.

Index

Constants

View Source
const (
	// ErrEncrypt is the leading sentinel wrapped when age encryption fails.
	ErrEncrypt errs.Const = "failed to encrypt"
	// ErrDecrypt is the leading sentinel wrapped when age decryption fails.
	ErrDecrypt errs.Const = "failed to decrypt"
	// ErrOpenFile is the leading sentinel wrapped when an identity file cannot
	// be read.
	ErrOpenFile errs.Const = "failed to open file"
	// ErrParseIdentity is the leading sentinel wrapped when an SSH private key
	// cannot be parsed into an age identity.
	ErrParseIdentity errs.Const = "failed to parse identity"
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(w io.Writer, r io.Reader, identities Identities) error

Decrypt writes age-decrypted data from r to w using the given identities.

func Encrypt

func Encrypt(w io.Writer, r io.Reader, recipients Recipients) error

Encrypt writes age-encrypted data from r to w for the given recipients.

Types

type Identities

type Identities []age.Identity

Identities is the set of age identities Decrypt attempts to unseal with.

func ParseIdentities

func ParseIdentities(path IdentityFile) (Identities, error)

ParseIdentities reads an SSH private key file and returns age identities.

type IdentityFile

type IdentityFile string

IdentityFile is the path to an SSH private-key file that ParseIdentities reads age identities from.

type Recipients

type Recipients []age.Recipient

Recipients is the set of age recipients data is sealed to by Encrypt.

Jump to

Keyboard shortcuts

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