pgp

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKeyToKeyRingFromReader

func AddKeyToKeyRingFromReader(keyring *KeyRing, name string, reader io.Reader) error

AddKeyToKeyRingFromReader imports the PGP keys stored in a Reader into the passed KeyRing.

func Verify

func Verify(keyring openpgp.KeyRing, signed string) (string, error)

Verify verifies a signed message's signature, and returns the message that was signed as well as an error if applicable.

Types

type KeyRing

type KeyRing struct {
	// contains filtered or unexported fields
}

KeyRing wraps an OpenPGP EntityList (which implements openpgp.KeyRing), adding support for determining which key is associated with which check. KeyRing implements openpgp.KeyRing, thus can be used in place of it where appropriate.

func NewKeyRing

func NewKeyRing() *KeyRing

NewKeyRing creates a new keyring from the passed EntityList. The keys in the input EntityList are then associated with the

func (*KeyRing) AddEntities

func (keyring *KeyRing) AddEntities(name string, input openpgp.EntityList)

AddEntities adds new keys from the passed EntityList to the keyring for use.

func (*KeyRing) Close

func (keyring *KeyRing) Close() error

Close closes the open PGP signer. This function does nothing but satisifies the interface.

func (*KeyRing) DecryptionKeys

func (keyring *KeyRing) DecryptionKeys() []openpgp.Key

DecryptionKeys returns all private keys that are valid for decryption.

func (*KeyRing) GetSignerByName

func (keyring *KeyRing) GetSignerByName(name string) (*openpgp.Entity, error)

GetSignerByName gets the first available signing key associated with the passed name.

func (*KeyRing) KeysById

func (keyring *KeyRing) KeysById(id uint64) []openpgp.Key

KeysById returns the set of keys that have the given key id.

func (*KeyRing) KeysByIdUsage

func (keyring *KeyRing) KeysByIdUsage(id uint64, requiredUsage byte) []openpgp.Key

KeysByIdUsage returns the set of keys with the given id that also meet the key usage given by requiredUsage. The requiredUsage is expressed as the bitwise-OR of packet.KeyFlag* values.

func (*KeyRing) Sign

func (keyring *KeyRing) Sign(checkName, body string) (string, string, error)

Jump to

Keyboard shortcuts

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