Documentation
¶
Overview ¶
Package gpgme provides a Go wrapper for the GPGME library
Index ¶
- Constants
- Variables
- func EngineCheckVersion(p Protocol) error
- func GetDirInfo(what string) string
- func SetEngineInfo(proto Protocol, fileName, homeDir string) error
- type AssuanDataCallback
- type AssuanInquireCallback
- type AssuanStatusCallback
- type Callback
- type Context
- func (c *Context) Armor() bool
- func (c *Context) AssuanSend(cmd string, data AssuanDataCallback, inquiry AssuanInquireCallback, ...) error
- func (c *Context) Decrypt(ciphertext, plaintext *Data) error
- func (c *Context) DecryptVerify(ciphertext, plaintext *Data) error
- func (c *Context) Encrypt(recipients []*Key, flags EncryptFlag, plaintext, ciphertext *Data) error
- func (c *Context) EngineInfo() *EngineInfo
- func (c *Context) Export(pattern string, mode ExportModeFlags, data *Data) error
- func (c *Context) GetKey(fingerprint string, secret bool) (*Key, error)
- func (c *Context) Import(keyData *Data) (*ImportResult, error)
- func (c *Context) KeyListEnd() error
- func (c *Context) KeyListMode() KeyListMode
- func (c *Context) KeyListNext() bool
- func (c *Context) KeyListStart(pattern string, secretOnly bool) error
- func (c *Context) PinEntryMode() PinEntryMode
- func (c *Context) Protocol() Protocol
- func (c *Context) Release()
- func (c *Context) SetArmor(yes bool)
- func (c *Context) SetCallback(callback Callback) error
- func (c *Context) SetEngineInfo(proto Protocol, fileName, homeDir string) error
- func (c *Context) SetKeyListMode(m KeyListMode) error
- func (c *Context) SetPinEntryMode(m PinEntryMode) error
- func (c *Context) SetProtocol(p Protocol) error
- func (c *Context) SetTextMode(yes bool)
- func (c *Context) Sign(signers []*Key, plain, sig *Data, mode SigMode) error
- func (c *Context) TextMode() bool
- func (c *Context) Verify(sig, signedText, plain *Data) (string, []Signature, error)
- type Data
- func Decrypt(r io.Reader) (*Data, error)
- func NewData() (*Data, error)
- func NewDataBytes(b []byte) (*Data, error)
- func NewDataFile(f *os.File) (*Data, error)
- func NewDataReadWriteSeeker(rw io.ReadWriteSeeker) (*Data, error)
- func NewDataReadWriter(rw io.ReadWriter) (*Data, error)
- func NewDataReader(r io.Reader) (*Data, error)
- func NewDataWriter(w io.Writer) (*Data, error)
- type EncryptFlag
- type EngineInfo
- type Error
- type ErrorCode
- type ExportModeFlags
- type HashAlgo
- type ImportResult
- type ImportStatus
- type ImportStatusFlags
- type Key
- func (k *Key) CanAuthenticate() bool
- func (k *Key) CanCertify() bool
- func (k *Key) CanEncrypt() bool
- func (k *Key) CanSign() bool
- func (k *Key) ChainID() string
- func (k *Key) Disabled() bool
- func (k *Key) Expired() bool
- func (k *Key) Invalid() bool
- func (k *Key) IsQualified() bool
- func (k *Key) IssuerName() string
- func (k *Key) IssuerSerial() string
- func (k *Key) KeyListMode() KeyListMode
- func (k *Key) OwnerTrust() Validity
- func (k *Key) Protocol() Protocol
- func (k *Key) Release()
- func (k *Key) Revoked() bool
- func (k *Key) Secret() bool
- func (k *Key) SubKeys() *SubKey
- func (k *Key) UserIDs() *UserID
- type KeyListMode
- type PinEntryMode
- type Protocol
- type PubkeyAlgo
- type SigMode
- type SigSum
- type Signature
- type SubKey
- func (k *SubKey) CardNumber() string
- func (k *SubKey) Created() time.Time
- func (k *SubKey) Disabled() bool
- func (k *SubKey) Expired() bool
- func (k *SubKey) Expires() time.Time
- func (k *SubKey) Fingerprint() string
- func (k *SubKey) Invalid() bool
- func (k *SubKey) KeyID() string
- func (k *SubKey) Next() *SubKey
- func (k *SubKey) Revoked() bool
- func (k *SubKey) Secret() bool
- type UserID
- type Validity
Constants ¶
Variables ¶
var Version string
Functions ¶
func EngineCheckVersion ¶
func GetDirInfo ¶ added in v0.1.4
func SetEngineInfo ¶
Types ¶
type AssuanDataCallback ¶
type AssuanInquireCallback ¶
type AssuanStatusCallback ¶
type Context ¶
func (*Context) AssuanSend ¶
func (c *Context) AssuanSend( cmd string, data AssuanDataCallback, inquiry AssuanInquireCallback, status AssuanStatusCallback, ) error
AssuanSend sends a raw Assuan command to gpg-agent
func (*Context) DecryptVerify ¶
func (*Context) Encrypt ¶
func (c *Context) Encrypt(recipients []*Key, flags EncryptFlag, plaintext, ciphertext *Data) error
func (*Context) EngineInfo ¶
func (c *Context) EngineInfo() *EngineInfo
func (*Context) Export ¶
func (c *Context) Export(pattern string, mode ExportModeFlags, data *Data) error
func (*Context) KeyListEnd ¶
func (*Context) KeyListMode ¶
func (c *Context) KeyListMode() KeyListMode
func (*Context) KeyListNext ¶
func (*Context) KeyListStart ¶
func (*Context) PinEntryMode ¶
func (c *Context) PinEntryMode() PinEntryMode
func (*Context) SetCallback ¶
func (*Context) SetEngineInfo ¶
func (*Context) SetKeyListMode ¶
func (c *Context) SetKeyListMode(m KeyListMode) error
func (*Context) SetPinEntryMode ¶
func (c *Context) SetPinEntryMode(m PinEntryMode) error
func (*Context) SetProtocol ¶
func (*Context) SetTextMode ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
The Data buffer used to communicate with GPGME
func NewDataBytes ¶
NewDataBytes returns a new memory based data buffer that contains `b` bytes
func NewDataFile ¶
NewDataFile returns a new file based data buffer
func NewDataReadWriteSeeker ¶
func NewDataReadWriteSeeker(rw io.ReadWriteSeeker) (*Data, error)
NewDataReadWriteSeeker returns a new callback based data buffer
func NewDataReadWriter ¶
func NewDataReadWriter(rw io.ReadWriter) (*Data, error)
NewDataReadWriter returns a new callback based data buffer
func NewDataReader ¶
NewDataReader returns a new callback based data buffer
func NewDataWriter ¶
NewDataWriter returns a new callback based data buffer
type EncryptFlag ¶
type EncryptFlag uint
const ( EncryptAlwaysTrust EncryptFlag = C.GPGME_ENCRYPT_ALWAYS_TRUST EncryptNoEncryptTo EncryptFlag = C.GPGME_ENCRYPT_NO_ENCRYPT_TO EncryptPrepare EncryptFlag = C.GPGME_ENCRYPT_PREPARE EncryptExceptSign EncryptFlag = C.GPGME_ENCRYPT_EXPECT_SIGN )
type EngineInfo ¶
type EngineInfo struct {
// contains filtered or unexported fields
}
func GetEngineInfo ¶
func GetEngineInfo() (*EngineInfo, error)
func (*EngineInfo) FileName ¶
func (e *EngineInfo) FileName() string
func (*EngineInfo) HomeDir ¶
func (e *EngineInfo) HomeDir() string
func (*EngineInfo) Next ¶
func (e *EngineInfo) Next() *EngineInfo
func (*EngineInfo) Protocol ¶
func (e *EngineInfo) Protocol() Protocol
func (*EngineInfo) RequiredVersion ¶
func (e *EngineInfo) RequiredVersion() string
func (*EngineInfo) Version ¶
func (e *EngineInfo) Version() string
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a wrapper for GPGME errors
type ErrorCode ¶
type ErrorCode int
const ( ErrorNoError ErrorCode = C.GPG_ERR_NO_ERROR ErrorEOF ErrorCode = C.GPG_ERR_EOF )
type ExportModeFlags ¶
type ExportModeFlags uint
ExportModeFlags defines how keys are exported from Export
const ( ExportModeExtern ExportModeFlags = C.GPGME_EXPORT_MODE_EXTERN ExportModeMinimal ExportModeFlags = C.GPGME_EXPORT_MODE_MINIMAL )
type ImportResult ¶
type ImportStatus ¶
type ImportStatus struct { Fingerprint string Result error Status ImportStatusFlags }
type ImportStatusFlags ¶
type ImportStatusFlags uint
ImportStatusFlags describes the type of ImportStatus.Status. The C API in gpgme.h simply uses "unsigned".
const ( ImportNew ImportStatusFlags = C.GPGME_IMPORT_NEW ImportUID ImportStatusFlags = C.GPGME_IMPORT_UID ImportSIG ImportStatusFlags = C.GPGME_IMPORT_SIG ImportSubKey ImportStatusFlags = C.GPGME_IMPORT_SUBKEY ImportSecret ImportStatusFlags = C.GPGME_IMPORT_SECRET )
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func (*Key) CanAuthenticate ¶
func (*Key) CanCertify ¶
func (*Key) CanEncrypt ¶
func (*Key) IsQualified ¶
func (*Key) IssuerName ¶
func (*Key) IssuerSerial ¶
func (*Key) KeyListMode ¶
func (k *Key) KeyListMode() KeyListMode
func (*Key) OwnerTrust ¶
type KeyListMode ¶
type KeyListMode uint
const ( KeyListModeLocal KeyListMode = C.GPGME_KEYLIST_MODE_LOCAL KeyListModeExtern KeyListMode = C.GPGME_KEYLIST_MODE_EXTERN KeyListModeSigs KeyListMode = C.GPGME_KEYLIST_MODE_SIGS KeyListModeSigNotations KeyListMode = C.GPGME_KEYLIST_MODE_SIG_NOTATIONS KeyListModeEphemeral KeyListMode = C.GPGME_KEYLIST_MODE_EPHEMERAL KeyListModeModeValidate KeyListMode = C.GPGME_KEYLIST_MODE_VALIDATE )
type PinEntryMode ¶
type PinEntryMode int
const ( PinEntryDefault PinEntryMode = C.GPGME_PINENTRY_MODE_DEFAULT PinEntryAsk PinEntryMode = C.GPGME_PINENTRY_MODE_ASK PinEntryCancel PinEntryMode = C.GPGME_PINENTRY_MODE_CANCEL PinEntryError PinEntryMode = C.GPGME_PINENTRY_MODE_ERROR PinEntryLoopback PinEntryMode = C.GPGME_PINENTRY_MODE_LOOPBACK )
type Protocol ¶
type Protocol int
const ( ProtocolOpenPGP Protocol = C.GPGME_PROTOCOL_OpenPGP ProtocolCMS Protocol = C.GPGME_PROTOCOL_CMS ProtocolGPGConf Protocol = C.GPGME_PROTOCOL_GPGCONF ProtocolAssuan Protocol = C.GPGME_PROTOCOL_ASSUAN ProtocolG13 Protocol = C.GPGME_PROTOCOL_G13 ProtocolUIServer Protocol = C.GPGME_PROTOCOL_UISERVER ProtocolDefault Protocol = C.GPGME_PROTOCOL_DEFAULT ProtocolUnknown Protocol = C.GPGME_PROTOCOL_UNKNOWN )
type PubkeyAlgo ¶
type PubkeyAlgo int
type SigMode ¶
type SigMode int
const ( SigModeNormal SigMode = C.GPGME_SIG_MODE_NORMAL SigModeDetach SigMode = C.GPGME_SIG_MODE_DETACH SigModeClear SigMode = C.GPGME_SIG_MODE_CLEAR )
type SigSum ¶
type SigSum int
const ( SigSumValid SigSum = C.GPGME_SIGSUM_VALID SigSumGreen SigSum = C.GPGME_SIGSUM_GREEN SigSumRed SigSum = C.GPGME_SIGSUM_RED SigSumKeyRevoked SigSum = C.GPGME_SIGSUM_KEY_REVOKED SigSumKeyExpired SigSum = C.GPGME_SIGSUM_KEY_EXPIRED SigSumSigExpired SigSum = C.GPGME_SIGSUM_SIG_EXPIRED SigSumKeyMissing SigSum = C.GPGME_SIGSUM_KEY_MISSING SigSumCRLMissing SigSum = C.GPGME_SIGSUM_CRL_MISSING SigSumCRLTooOld SigSum = C.GPGME_SIGSUM_CRL_TOO_OLD SigSumBadPolicy SigSum = C.GPGME_SIGSUM_BAD_POLICY SigSumSysError SigSum = C.GPGME_SIGSUM_SYS_ERROR )
type SubKey ¶
type SubKey struct {
// contains filtered or unexported fields
}
func (*SubKey) CardNumber ¶
func (*SubKey) Fingerprint ¶
type Validity ¶
type Validity int
const ( ValidityUnknown Validity = C.GPGME_VALIDITY_UNKNOWN ValidityUndefined Validity = C.GPGME_VALIDITY_UNDEFINED ValidityNever Validity = C.GPGME_VALIDITY_NEVER ValidityMarginal Validity = C.GPGME_VALIDITY_MARGINAL ValidityFull Validity = C.GPGME_VALIDITY_FULL ValidityUltimate Validity = C.GPGME_VALIDITY_ULTIMATE )