pgp

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MPL-2.0 Imports: 7 Imported by: 4

Documentation

Overview

Package pgp contains the logic related to the PGP key management.

Index

Constants

View Source
const (
	MaxAllowedLifetime = 8 * time.Hour
	AllowedClockSkew   = 5 * time.Minute
)

Time-related key settings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

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

Key represents a PGP key. It can be a public key or a private & public key pair.

func GenerateKey

func GenerateKey(name, comment, email string, lifetime time.Duration) (*Key, error)

GenerateKey generates a new PGP key pair.

func NewKey

func NewKey(key *pgpcrypto.Key) (*Key, error)

NewKey returns a new PGP key from the given pgpcrypto.Key.

func (*Key) Armor

func (p *Key) Armor() (string, error)

Armor returns the key in the armored format.

func (*Key) ArmorPublic

func (p *Key) ArmorPublic() (string, error)

ArmorPublic returns only the public key in armored format.

func (*Key) Fingerprint

func (p *Key) Fingerprint() string

Fingerprint returns the fingerprint of the key.

func (*Key) IsExpired added in v0.2.1

func (p *Key) IsExpired(clockSkew time.Duration) bool

IsExpired returns true if the key is expired with clock skew.

func (*Key) IsPrivate

func (p *Key) IsPrivate() bool

IsPrivate returns true if the key contains a private key.

func (*Key) IsUnlocked

func (p *Key) IsUnlocked() (bool, error)

IsUnlocked returns true if the private key is unlocked.

func (*Key) Sign

func (p *Key) Sign(data []byte) ([]byte, error)

Sign signs the given data using the private key.

func (*Key) Validate

func (p *Key) Validate() error

Validate validates the key.

func (*Key) Verify

func (p *Key) Verify(data, signature []byte) error

Verify verifies the signature of the given data using the public key.

Directories

Path Synopsis
Package client provides utilities for handling client-side PGP keys.
Package client provides utilities for handling client-side PGP keys.

Jump to

Keyboard shortcuts

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