Documentation ¶
Overview ¶
Package pgp provides interface to signature generation and validation
Index ¶
- type GPGFinder
- type GPGVersion
- type GoSigner
- func (g *GoSigner) ClearSign(source string, destination string) error
- func (g *GoSigner) DetachedSign(source string, destination string) error
- func (g *GoSigner) Init() error
- func (g *GoSigner) SetBatch(batch bool)
- func (g *GoSigner) SetKey(keyRef string)
- func (g *GoSigner) SetKeyRing(keyring, secretKeyring string)
- func (g *GoSigner) SetPassphrase(passphrase, passphraseFile string)
- type GoVerifier
- func (g *GoVerifier) AddKeyring(keyring string)
- func (g *GoVerifier) ExtractClearsigned(clearsigned io.Reader) (text *os.File, err error)
- func (g *GoVerifier) InitKeyring() error
- func (g *GoVerifier) IsClearSigned(clearsigned io.Reader) (bool, error)
- func (g *GoVerifier) VerifyClearsigned(clearsigned io.Reader, showKeyTip bool) (*KeyInfo, error)
- func (g *GoVerifier) VerifyDetachedSignature(signature, cleartext io.Reader, showKeyTip bool) error
- type GpgSigner
- func (g *GpgSigner) ClearSign(source string, destination string) error
- func (g *GpgSigner) DetachedSign(source string, destination string) error
- func (g *GpgSigner) Init() error
- func (g *GpgSigner) SetBatch(batch bool)
- func (g *GpgSigner) SetKey(keyRef string)
- func (g *GpgSigner) SetKeyRing(keyring, secretKeyring string)
- func (g *GpgSigner) SetPassphrase(passphrase, passphraseFile string)
- type GpgVerifier
- func (g *GpgVerifier) AddKeyring(keyring string)
- func (g *GpgVerifier) ExtractClearsigned(clearsigned io.Reader) (text *os.File, err error)
- func (g *GpgVerifier) InitKeyring() error
- func (g *GpgVerifier) IsClearSigned(clearsigned io.Reader) (bool, error)
- func (g *GpgVerifier) VerifyClearsigned(clearsigned io.Reader, showKeyTip bool) (*KeyInfo, error)
- func (g *GpgVerifier) VerifyDetachedSignature(signature, cleartext io.Reader, showKeyTip bool) error
- type Key
- type KeyInfo
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GPGFinder ¶ added in v1.4.0
type GPGFinder interface { FindGPG() (gpg string, version GPGVersion, err error) FindGPGV() (gpgv string, version GPGVersion, err error) }
GPGFinder implement search for gpg executables and returns version of discovered executables
func GPGDefaultFinder ¶ added in v1.4.0
func GPGDefaultFinder() GPGFinder
GPGDefaultFinder looks for GPG1 first, but falls back to GPG2 if GPG1 is not available
type GPGVersion ¶ added in v1.4.0
type GPGVersion int
GPGVersion stores discovered GPG version
const ( GPG1x GPGVersion = 1 GPG20x GPGVersion = 2 GPG21xPlus GPGVersion = 3 )
GPG version as discovered
type GoSigner ¶
type GoSigner struct {
// contains filtered or unexported fields
}
GoSigner is implementation of Signer interface using Go internal OpenPGP library
func (*GoSigner) DetachedSign ¶
DetachedSign signs file with detached signature in ASCII format
func (*GoSigner) SetKeyRing ¶
SetKeyRing allows to set custom keyring and secretkeyring
func (*GoSigner) SetPassphrase ¶
SetPassphrase sets passhprase params
type GoVerifier ¶
type GoVerifier struct {
// contains filtered or unexported fields
}
GoVerifier is implementation of Verifier interface using Go internal OpenPGP library
func (*GoVerifier) AddKeyring ¶
func (g *GoVerifier) AddKeyring(keyring string)
AddKeyring adds custom keyrings to the list
func (*GoVerifier) ExtractClearsigned ¶
ExtractClearsigned extracts cleartext from clearsigned file WITHOUT signature verification
func (*GoVerifier) InitKeyring ¶
func (g *GoVerifier) InitKeyring() error
InitKeyring verifies that gpg is installed and some keys are trusted
func (*GoVerifier) IsClearSigned ¶
func (g *GoVerifier) IsClearSigned(clearsigned io.Reader) (bool, error)
IsClearSigned returns true if file contains signature
func (*GoVerifier) VerifyClearsigned ¶
VerifyClearsigned verifies clearsigned file using gpgv
func (*GoVerifier) VerifyDetachedSignature ¶
func (g *GoVerifier) VerifyDetachedSignature(signature, cleartext io.Reader, showKeyTip bool) error
VerifyDetachedSignature verifies combination of signature and cleartext using gpgv
type GpgSigner ¶
type GpgSigner struct {
// contains filtered or unexported fields
}
GpgSigner is implementation of Signer interface using gpg as external program
func NewGpgSigner ¶ added in v1.3.0
NewGpgSigner creates a new gpg signer
func (*GpgSigner) DetachedSign ¶
DetachedSign signs file with detached signature in ASCII format
func (*GpgSigner) SetKeyRing ¶
SetKeyRing allows to set custom keyring and secretkeyring
func (*GpgSigner) SetPassphrase ¶
SetPassphrase sets passhprase params
type GpgVerifier ¶
type GpgVerifier struct {
// contains filtered or unexported fields
}
GpgVerifier is implementation of Verifier interface using gpgv as external program
func NewGpgVerifier ¶ added in v1.3.0
func NewGpgVerifier(finder GPGFinder) *GpgVerifier
NewGpgVerifier creates a new gpg verifier
func (*GpgVerifier) AddKeyring ¶
func (g *GpgVerifier) AddKeyring(keyring string)
AddKeyring adds custom keyring to GPG parameters
func (*GpgVerifier) ExtractClearsigned ¶
ExtractClearsigned extracts cleartext from clearsigned file WITHOUT signature verification
func (*GpgVerifier) InitKeyring ¶
func (g *GpgVerifier) InitKeyring() error
InitKeyring verifies that gpg is installed and some keys are trusted
func (*GpgVerifier) IsClearSigned ¶
func (g *GpgVerifier) IsClearSigned(clearsigned io.Reader) (bool, error)
IsClearSigned returns true if file contains signature
func (*GpgVerifier) VerifyClearsigned ¶
VerifyClearsigned verifies clearsigned file using gpgv
func (*GpgVerifier) VerifyDetachedSignature ¶
func (g *GpgVerifier) VerifyDetachedSignature(signature, cleartext io.Reader, showKeyTip bool) error
VerifyDetachedSignature verifies combination of signature and cleartext using gpgv
type Key ¶
type Key string
Key is key in PGP representation
func KeyFromUint64 ¶
KeyFromUint64 converts openpgp uint64 into hex human-readable
type Signer ¶
type Signer interface { Init() error SetKey(keyRef string) SetKeyRing(keyring, secretKeyring string) SetPassphrase(passphrase, passphraseFile string) SetBatch(batch bool) DetachedSign(source string, destination string) error ClearSign(source string, destination string) error }
Signer interface describes facility implementing signing of files
type Verifier ¶
type Verifier interface { InitKeyring() error AddKeyring(keyring string) VerifyDetachedSignature(signature, cleartext io.Reader, showKeyTip bool) error IsClearSigned(clearsigned io.Reader) (bool, error) VerifyClearsigned(clearsigned io.Reader, showKeyTip bool) (*KeyInfo, error) ExtractClearsigned(clearsigned io.Reader) (text *os.File, err error) }
Verifier interface describes signature verification factility