gpg

package
v1.15.11 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = fmt.Errorf("no matching key found")

ErrKeyNotFound is returned when a key is not found.

Functions

func IsAlwaysTrust

func IsAlwaysTrust(ctx context.Context) bool

IsAlwaysTrust will return the value of the always trust flag or the default (false).

func UseCache

func UseCache(ctx context.Context) bool

UseCache returns true if this request should ignore the cache.

func WithAlwaysTrust

func WithAlwaysTrust(ctx context.Context, at bool) context.Context

WithAlwaysTrust will return a context with the flag for always trust set.

func WithUseCache

func WithUseCache(ctx context.Context, nc bool) context.Context

WithUseCache returns a context with the value of NoCache set.

Types

type Capabilities added in v1.14.0

type Capabilities struct {
	Encrypt        bool
	Sign           bool
	Certify        bool
	Authentication bool
	Deactivated    bool
}

Capabilities of a Key.

type Identity

type Identity struct {
	Name           string
	Comment        string
	Email          string
	CreationDate   time.Time
	ExpirationDate time.Time
}

Identity is a GPG identity, one key can have many IDs.

func (Identity) ID

func (i Identity) ID() string

ID returns the GPG ID format.

func (Identity) String

func (i Identity) String() string

String implement fmt.Stringer. This method resembles the output gpg uses for user-ids.

type Key

type Key struct {
	KeyType        string
	KeyLength      int
	Validity       string
	CreationDate   time.Time
	ExpirationDate time.Time
	Ownertrust     string
	Fingerprint    string
	Identities     map[string]Identity
	SubKeys        map[string]struct{}
	Caps           Capabilities
}

Key is a GPG key (public or secret).

func (Key) ID

func (k Key) ID() string

ID returns the short fingerprint.

func (Key) Identity

func (k Key) Identity() Identity

Identity returns the first identity.

func (Key) IsUseable

func (k Key) IsUseable(alwaysTrust bool) bool

IsUseable returns true if GPG would assume this key is useable for encryption.

func (Key) OneLine

func (k Key) OneLine() string

OneLine prints a terse representation of this key on one line (includes only the first identity!).

func (Key) String

func (k Key) String() string

String implement fmt.Stringer. This method produces output that is close to, but not exactly the same, as the output form GPG itself.

type KeyList

type KeyList []Key

KeyList is a searchable slice of Keys.

func (KeyList) FindKey

func (kl KeyList) FindKey(id string) (Key, error)

FindKey will try to find the requested key.

func (KeyList) Len

func (kl KeyList) Len() int

func (KeyList) Less

func (kl KeyList) Less(i, j int) bool

func (KeyList) Recipients

func (kl KeyList) Recipients() []string

Recipients returns the KeyList formatted as a recipient list.

func (KeyList) Swap

func (kl KeyList) Swap(i, j int)

func (KeyList) UnusableKeys

func (kl KeyList) UnusableKeys(alwaysTrust bool) KeyList

UnusableKeys returns the list of unusable keys (invalid keys).

func (KeyList) UseableKeys

func (kl KeyList) UseableKeys(alwaysTrust bool) KeyList

UseableKeys returns the list of useable (valid keys).

Directories

Path Synopsis
Package cli implements a GPG CLI crypto backend.
Package cli implements a GPG CLI crypto backend.

Jump to

Keyboard shortcuts

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