Documentation
¶
Index ¶
- Variables
- func ComputeDetachedSignature(inFile, outFile string, keySrc KeySource) errors.Error
- func DecryptFile(inFile, outFile string, keySrc KeySource, options *Options) errors.Error
- func DecryptFileAndCheckSignature(inFile, outFile string, decryptKeySrc, signKeySrc KeySource, options *Options) errors.Error
- func DecryptFileToByteSlice(inFile string, keySrc KeySource, options *Options) ([]byte, errors.Error)
- func EncryptAndSignFile(inFile, outFile string, encryptKeySrc, signKeySrc KeySource, options *Options) errors.Error
- func EncryptFile(inFile, outFile string, encryptKeySrc KeySource, options *Options) errors.Error
- type KeySource
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTechnicalProblem occurs on all errors not related to cryptography. ErrTechnicalProblem = errors.New("Technical error") // ErrNoKeySpecified occurs when a mandatory key is not specified. ErrNoKeySpecified = errors.New("No key specified") // ErrNoPrivateKey occurs when a public key is supplied, but a private key is expected. ErrNoPrivateKey = errors.New("Require private key") // ErrWrongKey occurs when a wrong key is used for decrypting or signature checking. ErrWrongKey = errors.New("Wrong key") // ErrKeySourceNotAccepted occurs on importing a disabled key source (See gpgutil.AcceptFileKeySources and gpgutil.AcceptNamedKeySources) ErrKeySourceNotAccepted = errors.New("Key source %q not accepted") // ErrImportKeyFailed occurs when a specified key could not be imported. ErrImportKeyFailed = errors.New("Failed to import key") // ErrDecryptKeyFailed occurs when a specified key was imported but could not be decrypted. ErrDecryptKeyFailed = errors.New("Failed to decrypt key") // ErrWrongSignatureVerificationKey occurs when the key for signature verification does not match the signer. ErrWrongSignatureVerificationKey = errors.New("Wrong key for signature verification") // ErrWrongSignature occurs when a signature does not verify the given message. ErrWrongSignature = errors.New("Wrong signature") // ErrMissingSignature occurs when a signature was expected but does not exist. ErrMissingSignature = errors.New("Missing signature") // ErrGPG occurs on all cryptography related errors. ErrGPG = errors.New("A cryptographic method failed") )
var ( // GPGCommand can be used to override the command to execute gpg on this machine. GPGCommand string // AcceptFileKeySources determines whether file key sources are accepted. AcceptFileKeySources bool // AcceptNamedKeySources determines whether named key sources are accepted. AcceptNamedKeySources bool )
Functions ¶
func ComputeDetachedSignature ¶
ComputeDetachedSignature creates a detached signature of inFile and writes it to outFile using the given GPG key.
func DecryptFile ¶
DecryptFile decrypts a gzipped gpg file.
func DecryptFileAndCheckSignature ¶
func DecryptFileAndCheckSignature(inFile, outFile string, decryptKeySrc, signKeySrc KeySource, options *Options) errors.Error
DecryptFileAndCheckSignature decrypts a gzipped gpg file and checks the signature.
func DecryptFileToByteSlice ¶
Types ¶
type KeySource ¶
type KeySource struct { File string `json:"file"` Owner string `json:"owner"` Passphrase string `json:"passphrase"` }
KeySource describes a file or named source for protected and unprotected PGP keys.
func MakeEmptyKeySource ¶
func MakeEmptyKeySource() KeySource
MakeEmptyKeySource returns a key source that does not describe a key. Can be used for optional keys.
func MakeFileKeySource ¶
MakeFileKeySource returns a file key source with passphrase. Leave empty for unencrypted keys.
func MakeNamedKeySource ¶
MakeNamedKeySource returns a named key source with passphrase. Leave empty for unencrypted keys.
func (KeySource) IsFileSource ¶
IsFileSource returns true, when the key source is a file.
func (KeySource) IsNamedSource ¶
IsNamedSource returns true, when the key source denotes a key in local gpg store.