...

Package pgptools

import "github.com/sassoftware/relic/lib/pgptools"
Overview
Index

Overview ▾

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

type ErrNoContent

Returned by VerifyInline if the signature is actually a detached signature

type ErrNoContent struct{}

func (ErrNoContent) Error

func (ErrNoContent) Error() string

type ErrNoKey

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

type ErrNoKey uint64

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.