Documentation ¶
Index ¶
- Variables
- func Decrypt(path string) ([]byte, error)
- func Encrypt(path string, content []byte, recipients []string, alwaysTrust bool) error
- func ExportPublicKey(id, filename string) error
- func GetRecipients(file string) ([]string, error)
- func ImportPublicKey(filename string) error
- type Identity
- type Key
- type KeyList
Constants ¶
This section is empty.
Variables ¶
var ( // GPGArgs contains the default GPG args for non-interactive use. Note: Do not use '--batch' // as this will disable (necessary) passphrase questions! GPGArgs = []string{"--quiet", "--yes", "--compress-algo=none", "--no-encrypt-to", "--no-auto-check-trustdb"} // Debug prints all the commands executed Debug = false // GPGBin is the name and possibly location of the gpg binary GPGBin = "gpg" )
Functions ¶
func Encrypt ¶
Encrypt will encrypt the given content for the recipients. If alwaysTrust is true the trust-model will be set to always as to avoid (annoying) "unuseable public key" errors when encrypting.
func ExportPublicKey ¶
ExportPublicKey will export the named public key to the location given
func GetRecipients ¶
GetRecipients returns a list of recipient IDs for a given file
func ImportPublicKey ¶
ImportPublicKey will import a key from the given location
Types ¶
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{} }
Key is a GPG key (public or secret)
func (Key) IsUseable ¶
IsUseable returns true if GPG would assume this key is useable for encryption
type KeyList ¶
type KeyList []Key
KeyList is a searchable slice of Keys
func ListPrivateKeys ¶
ListPrivateKeys returns a parsed list of GPG secret keys
func ListPublicKeys ¶
ListPublicKeys returns a parsed list of GPG public keys
func ParseColons ¶
ParseColons parses the `--with-colons` output format of GPG
func (KeyList) UseableKeys ¶
UseableKeys returns the list of useable (valid keys)