gpgbin

package
v0.0.0-...-0798a42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GPGErrors = map[string]GPGError{
	"gpg: no valid openpgp data found.": ERROR_NO_PGP_DATA_FOUND,
}

Functions

func Decrypt

func Decrypt(r io.Reader) (*models.MessageDetails, error)

Decrypt runs gpg --decrypt on the contents of r. If the packet is signed, the signature is also verified

func Encrypt

func Encrypt(r io.Reader, to []string, from string) ([]byte, error)

Encrypt runs gpg --encrypt [--sign] -r [recipient]. The default is to have --trust-model always set

func ExportPublicKey

func ExportPublicKey(k string) (io.Reader, error)

ExportPublicKey exports the public key identified by k in armor format

func GetKeyId

func GetKeyId(s string) (string, error)

GetKeyId runs gpg --list-keys s

func GetPrivateKeyId

func GetPrivateKeyId(s string) (string, error)

GetPrivateKeyId runs gpg --list-secret-keys s

func Import

func Import(r io.Reader) error

Import runs gpg --import and thus imports both private and public keys

func Sign

func Sign(r io.Reader, from string) ([]byte, string, error)

Sign creates a detached signature based on the contents of r

func Verify

func Verify(m io.Reader, s io.Reader) (*models.MessageDetails, error)

Verify runs gpg --verify. If s is not nil, then gpg interprets the arguments as a detached signature

Types

type GPGError

type GPGError int32
const (
	ERROR_NO_PGP_DATA_FOUND GPGError = iota + 1
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL