pgptools

package
v7.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearSign

func ClearSign(w io.Writer, signer *openpgp.Entity, message io.Reader, config *packet.Config) error

Do a cleartext signature, signing the document in "message" and writing the result to "w"

func DetachClearSign

func DetachClearSign(w io.Writer, signer *openpgp.Entity, message io.Reader, config *packet.Config) error

Do a cleartext signature but skip writing the embedded original document and write just the signature block to "w"

func EntityName

func EntityName(entity *openpgp.Entity) string

Return the primary identity name of a PGP entity

func MergeClearSign

func MergeClearSign(w io.Writer, sig []byte, message io.Reader) error

Create a cleartext signature by merging an original document stream in "message" with a detached signature in "sig" produced by DetachClearSign()

func MergeSignature

func MergeSignature(w io.Writer, sig []byte, message io.Reader, withArmor bool, filename string) (err error)

MergeSignature combines a detached signature with a cleartext message and writes it as an inline signed message with optional ASCII armor

Types

type ErrNoContent

type ErrNoContent struct{}

Returned by VerifyInline if the signature is actually a detached signature

func (ErrNoContent) Error

func (ErrNoContent) Error() string

type ErrNoKey

type ErrNoKey uint64

Returned by Verify* functions when the key used for signing is not in the keyring. The value is the KeyID of the missing key.

func (ErrNoKey) Error

func (e ErrNoKey) Error() string

type PgpSignature

type PgpSignature struct {
	Key          *openpgp.Key
	CreationTime time.Time
	Hash         crypto.Hash
}

func VerifyClearSign

func VerifyClearSign(signature io.Reader, cleartext io.Writer, keyring openpgp.EntityList) (*PgpSignature, error)

Verify a cleartext PGP signature in "signature" using keys from "keyring". Returns a value of ErrNoKey in the key cannot be found. If "cleartext" is not nil, then write the embedded cleartext as it is verified.

func VerifyDetached

func VerifyDetached(signature, signed io.Reader, keyring openpgp.EntityList) (*PgpSignature, error)

Verify a detached PGP signature in "signature" over the document in "signed", using keys from "keyring". Returns a value of ErrNoKey if the key cannot be found.

func VerifyInline

func VerifyInline(signature io.Reader, cleartext io.Writer, keyring openpgp.EntityList) (*PgpSignature, error)

Verify an inline PGP signature in "signature" using keys from "keyring". Returns a value of ErrNoKey if the key cannot be found. If "cleartext" is not nil, then write the embedded cleartext as it is verified.

Jump to

Keyboard shortcuts

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