Documentation ¶
Index ¶
- Constants
- Variables
- func ReadKeyRing(path string) (*openpgp.EntityList, error)
- func ReadPubRing(path string, keyIds []string) (*openpgp.EntityList, error)
- func ReadSecRing(path string) (*openpgp.EntityList, error)
- func UserIds() []string
- type ErrorCode
- type OpenPGPDecrypter
- type OpenPGPEncrypter
- type OpenPGPError
Constants ¶
const (
ERR_KEYRING = iota
)
OpenPGP error types constants
const PGP_MESSAGE_FOOTER string = "-----END PGP MESSAGE-----\n"
const PGP_MESSAGE_HEADER string = "-----BEGIN PGP MESSAGE-----\n\n"
PGP messages related constants
Variables ¶
var DEFAULT_GNUPG_DIR = ".gnupg"
var DEFAULT_GNUPG_PUBRING = filepath.Join( os.Getenv("USER"), DEFAULT_GNUPG_DIR, DEFAULT_GNUPG_PUBRING_FILE, )
var DEFAULT_GNUPG_PUBRING_FILE = "pubring.gpg"
var DEFAULT_GNUPG_SECRING = filepath.Join( os.Getenv("USER"), DEFAULT_GNUPG_DIR, DEFAULT_GNUPG_SECRING_FILE, )
var DEFAULT_GNUPG_SECRING_FILE = "secring.gpg"
var DEFAULT_GNUPG_THRUSTDB_FILE = "thrustdb.gpg"
Functions ¶
func ReadKeyRing ¶
func ReadKeyRing(path string) (*openpgp.EntityList, error)
func ReadPubRing ¶
func ReadPubRing(path string, keyIds []string) (*openpgp.EntityList, error)
func ReadSecRing ¶
func ReadSecRing(path string) (*openpgp.EntityList, error)
Types ¶
type OpenPGPDecrypter ¶
type OpenPGPDecrypter struct { // Keys represents the collection of decryption keys // present in your gnupg secret ring Keys *openpgp.EntityList // contains filtered or unexported fields }
func NewOpenPGPDecrypter ¶
func NewOpenPGPDecrypter(secRingPath string, passphrase string) (*OpenPGPDecrypter, error)
NewOpenPGPDecrypter builds a new OpenPGPDecrypter object from a gnupg secring file path and a passphrase. The returned object can then be used against OpenPGP encrypted bytes using the Decrypt method.
See Decrypter interface.
type OpenPGPEncrypter ¶
type OpenPGPEncrypter struct {
Keys *openpgp.EntityList
}
OpenPGPEncrypter implements the Encrypter interface. Provided an *openpgp.EntityList object it exposes an Encrypt method to encrypt provided plain bytes using OpenPGP algorithm.
func NewOpenPGPEncrypter ¶
func NewOpenPGPEncrypter(pubRingPath string, recipients []string) (*OpenPGPEncrypter, error)
NewOpenPGPEncrypter builds a new OpenPGPEncrypter object from provided gnupg pubring file path and a list of recipients. The returned object can then be used against byte slices to encrypt them with the OpenPGP encryption algorithm using the Encrypt method.
See Encrypter interface.
type OpenPGPError ¶
type OpenPGPError struct { Code ErrorCode // contains filtered or unexported fields }
func NewOpenPGPError ¶
func NewOpenPGPError(code ErrorCode, msg string) *OpenPGPError
func (*OpenPGPError) Error ¶
func (e *OpenPGPError) Error() string