pgp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMessage = errors.New("pgp: invalid message")

Functions

func MarshalPrivateKey

func MarshalPrivateKey(key *PrivateKey) ([]byte, error)

MarshalPrivateKey returns the armored private key.

func MarshalPublicKey

func MarshalPublicKey(key *PublicKey) ([]byte, error)

MarshalPublicKey returns the armored public key.

func Sign

func Sign(key *PrivateKey, data []byte) ([]byte, error)

Sign signs the data with the private key.

func SignText

func SignText(key *PrivateKey, data []byte) ([]byte, error)

SignText signs the data with the private key and wraps it in a signed message. Data is considered text and canonicalised with CRLF line endings.

func Split

func Split(msg []byte) (data, sig []byte, _ error)

Split splits a signed message into data and signature.

func Verify

func Verify(key *PublicKey, data, sig []byte) bool

Verify verifies the signature of the data with the public key.

Types

type PrivateKey

type PrivateKey = pgpcrypto.Key

func NewPrivateKey

func NewPrivateKey(name, email string) (*PrivateKey, error)

NewPrivateKey returns a new private key.

func UnmarshalPrivateKey

func UnmarshalPrivateKey(b []byte) (*PrivateKey, error)

UnmarshalPrivateKey returns a private key from an armored key.

type PublicKey

type PublicKey = pgpcrypto.Key

func Public

func Public(key *PrivateKey) *PublicKey

Public extracts the public key from a private key.

func UnmarshalPublicKey

func UnmarshalPublicKey(b []byte) (*PublicKey, error)

UnmarshalPublicKey returns a public key from an armored key.

Jump to

Keyboard shortcuts

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