gpgwrapper

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrProblemExecutingGPG

func ErrProblemExecutingGPG(gpgStdout string, arguments ...string) error

Types

type BadPasswordError

type BadPasswordError struct {
}

BadPasswordError represents an error from gpg that the passphrase was incorrect

func (*BadPasswordError) Error

func (e *BadPasswordError) Error() string

type GnuPG

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

GnuPG provides methods to access the user's installation of GnuPG

func Load added in v0.3.0

func Load() (*GnuPG, error)

Load find's the user's gpg binary and returns a GnuPG struct referencing it

func (*GnuPG) BackupHomeDir

func (g *GnuPG) BackupHomeDir(filepath string) (string, error)

BackupHomeDir makes a .tar backup file of the user's GnuPG directory to the given filepath

func (*GnuPG) ExportPrivateKey

func (g *GnuPG) ExportPrivateKey(fingerprint fpr.Fingerprint, password string) (string, error)

ExportPrivateKey returns 1 ascii armored private key for the given fingerprint, assuming it is encrypted with the given password. The outputted private key is encrypted with the password.

func (*GnuPG) ExportPublicKey

func (g *GnuPG) ExportPublicKey(fingerprint fpr.Fingerprint) (string, error)

ExportPublicKey returns 1 ascii armored public key for the given fingerprint

func (*GnuPG) HomeDir

func (g *GnuPG) HomeDir() (string, error)

HomeDir returns the GnuPG home directory, e.g. "/Users/jane/.gnupg"

func (*GnuPG) ImportArmoredKey

func (g *GnuPG) ImportArmoredKey(armoredKey string) error

ImportArmoredKey imports the given armored key into the GPG key ring

func (*GnuPG) IsWorking

func (g *GnuPG) IsWorking() bool

IsWorking checks whether GPG is working

func (*GnuPG) ListPublicKeys added in v1.0.0

func (g *GnuPG) ListPublicKeys(searchString string) ([]KeyListing, error)

ListPublicKeys lists the public keys in the users key ring that match a given search string.

func (*GnuPG) ListSecretKeys

func (g *GnuPG) ListSecretKeys() ([]KeyListing, error)

ListSecretKeys lists the secret(private) keys in the users key ring.

func (*GnuPG) TrustUltimately added in v1.0.0

func (g *GnuPG) TrustUltimately(fingerprint fpr.Fingerprint) error

TrustUltimately sets the ownertrust level of the given key to "ultimate", meaning "I trust this key to correctly certify other keys". At the very least we set our *own* keys' ownertrust to ultimate so our own certifications are valid.

func (*GnuPG) Version

func (g *GnuPG) Version() (string, error)

Version returns the GnuPG version string, e.g. "1.2.3"

type GnuPGInterface added in v1.0.0

type GnuPGInterface interface {
	ImportArmoredKey(string) error
	ExportPrivateKey(fingerprint fpr.Fingerprint, password string) (string, error)
	TrustUltimately(fpr.Fingerprint) error
}

GnuPGInterface allows mocking out GnuPG for testing

type KeyListing added in v1.0.0

type KeyListing struct {

	// Fingerprint is the human-readable format of the fingerprint of the
	// primary key, for example:
	// `AB01 AB01 AB01 AB01 AB01  AB01 AB01 AB01 AB01 AB01`
	Fingerprint fpr.Fingerprint

	// Uids is a list of UTF-8 user ID strings as defined in
	// https://tools.ietf.org/html/rfc4880#section-5.11
	Uids []string

	// Created is the time the key was apparently created in UTC.
	Created time.Time
}

KeyListing refers to a key parsed from running `gpg --list-[secret]-keys`

Jump to

Keyboard shortcuts

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