age

package
v1.0.0-beta2-UNO Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Package age implements file encryption according to age-encryption.org/v1.

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectIdentity = errors.New("incorrect identity for recipient block")

Functions

func Decrypt

func Decrypt(src io.Reader, identities ...Identity) (io.Reader, error)

func Encrypt

func Encrypt(dst io.Writer, recipients ...Recipient) (io.WriteCloser, error)

func EncryptWithArmor

func EncryptWithArmor(dst io.Writer, recipients ...Recipient) (io.WriteCloser, error)

func SSHFingerprint

func SSHFingerprint(pk ssh.PublicKey) string

Types

type Identity

type Identity interface {
	Type() string
	Unwrap(block *format.Recipient) (fileKey []byte, err error)
}

func ParseSSHIdentity

func ParseSSHIdentity(pemBytes []byte) (Identity, error)

type IdentityMatcher

type IdentityMatcher interface {
	Identity
	Matches(block *format.Recipient) error
}

type Recipient

type Recipient interface {
	Type() string
	Wrap(fileKey []byte) (*format.Recipient, error)
}

func ParseSSHRecipient

func ParseSSHRecipient(s string) (Recipient, error)

type SSHEd25519Identity

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

func NewSSHEd25519Identity

func NewSSHEd25519Identity(key ed25519.PrivateKey) (*SSHEd25519Identity, error)

func (*SSHEd25519Identity) Type

func (*SSHEd25519Identity) Type() string

func (*SSHEd25519Identity) Unwrap

func (i *SSHEd25519Identity) Unwrap(block *format.Recipient) ([]byte, error)

type SSHEd25519Recipient

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

func NewSSHEd25519Recipient

func NewSSHEd25519Recipient(pk ssh.PublicKey) (*SSHEd25519Recipient, error)

func (*SSHEd25519Recipient) Type

func (*SSHEd25519Recipient) Type() string

func (*SSHEd25519Recipient) Wrap

func (r *SSHEd25519Recipient) Wrap(fileKey []byte) (*format.Recipient, error)

type SSHRSAIdentity

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

func NewSSHRSAIdentity

func NewSSHRSAIdentity(key *rsa.PrivateKey) (*SSHRSAIdentity, error)

func (*SSHRSAIdentity) Type

func (*SSHRSAIdentity) Type() string

func (*SSHRSAIdentity) Unwrap

func (i *SSHRSAIdentity) Unwrap(block *format.Recipient) ([]byte, error)

type SSHRSARecipient

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

func NewSSHRSARecipient

func NewSSHRSARecipient(pk ssh.PublicKey) (*SSHRSARecipient, error)

func (*SSHRSARecipient) Type

func (*SSHRSARecipient) Type() string

func (*SSHRSARecipient) Wrap

func (r *SSHRSARecipient) Wrap(fileKey []byte) (*format.Recipient, error)

type ScryptIdentity

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

func NewScryptIdentity

func NewScryptIdentity(password string) (*ScryptIdentity, error)

func (*ScryptIdentity) SetMaxWorkFactor

func (i *ScryptIdentity) SetMaxWorkFactor(logN int)

SetWorkFactor sets the maximum accepted scrypt work factor to 2^logN. It must be called before Unwrap.

func (*ScryptIdentity) Type

func (*ScryptIdentity) Type() string

func (*ScryptIdentity) Unwrap

func (i *ScryptIdentity) Unwrap(block *format.Recipient) ([]byte, error)

type ScryptRecipient

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

func NewScryptRecipient

func NewScryptRecipient(password string) (*ScryptRecipient, error)

func (*ScryptRecipient) SetWorkFactor

func (r *ScryptRecipient) SetWorkFactor(logN int)

SetWorkFactor sets the scrypt work factor to 2^logN. It must be called before Wrap.

func (*ScryptRecipient) Type

func (*ScryptRecipient) Type() string

func (*ScryptRecipient) Wrap

func (r *ScryptRecipient) Wrap(fileKey []byte) (*format.Recipient, error)

type X25519Identity

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

func GenerateX25519Identity

func GenerateX25519Identity() (*X25519Identity, error)

func NewX25519Identity

func NewX25519Identity(secretKey []byte) (*X25519Identity, error)

func ParseX25519Identity

func ParseX25519Identity(s string) (*X25519Identity, error)

func (*X25519Identity) Recipient

func (i *X25519Identity) Recipient() *X25519Recipient

func (*X25519Identity) String

func (i *X25519Identity) String() string

func (*X25519Identity) Type

func (*X25519Identity) Type() string

func (*X25519Identity) Unwrap

func (i *X25519Identity) Unwrap(block *format.Recipient) ([]byte, error)

type X25519Recipient

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

func NewX25519Recipient

func NewX25519Recipient(publicKey []byte) (*X25519Recipient, error)

func ParseX25519Recipient

func ParseX25519Recipient(s string) (*X25519Recipient, error)

func (*X25519Recipient) String

func (r *X25519Recipient) String() string

func (*X25519Recipient) Type

func (*X25519Recipient) Type() string

func (*X25519Recipient) Wrap

func (r *X25519Recipient) Wrap(fileKey []byte) (*format.Recipient, error)

Jump to

Keyboard shortcuts

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