Documentation ¶
Index ¶
- func ErrProblemExecutingGPG(gpgStdout string, arguments ...string) error
- type BadPasswordError
- type GnuPG
- func (g *GnuPG) BackupHomeDir(filepath string) (string, error)
- func (g *GnuPG) ExportPrivateKey(fingerprint fpr.Fingerprint, password string) (string, error)
- func (g *GnuPG) ExportPublicKey(fingerprint fpr.Fingerprint) (string, error)
- func (g *GnuPG) HomeDir() (string, error)
- func (g *GnuPG) ImportArmoredKey(armoredKey string) error
- func (g *GnuPG) IsWorking() bool
- func (g *GnuPG) ListPublicKeys(searchString string) ([]KeyListing, error)
- func (g *GnuPG) ListSecretKeys() ([]KeyListing, error)
- func (g *GnuPG) TrustUltimately(fingerprint fpr.Fingerprint) error
- func (g *GnuPG) Version() (string, error)
- type GnuPGInterface
- type KeyListing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrProblemExecutingGPG ¶
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
Load find's the user's gpg binary and returns a GnuPG struct referencing it
func (*GnuPG) BackupHomeDir ¶
BackupHomeDir makes a .tar backup file of the user's GnuPG directory to the given filepath
func (*GnuPG) ExportPrivateKey ¶
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) ImportArmoredKey ¶
ImportArmoredKey imports the given armored key into the GPG key ring
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.
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`