openpgp

package
v0.0.0-...-ac4d359 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2015 License: ISC, ISC Imports: 16 Imported by: 0

README

openpgp: OpenPGP functions for the Keybase client

** NOTE WELL **

This package implements functionality anticipating the current Keybase set up. For example, no merging of imported keys is done.

Documentation

Index

Constants

View Source
const Version = "0.1.0"

Variables

View Source
var (
	DefaultPublicKeyRing = filepath.Join(os.Getenv("HOME"), ".gnupg", "pubring.gpg")
	DefaultSecretKeyRing = filepath.Join(os.Getenv("HOME"), ".gnupg", "secring.gpg")
)
View Source
var (
	ErrPubRing          = errors.New("openpgp: public keyring")
	ErrSecRing          = errors.New("openpgp: secret keyring")
	ErrSecStore         = errors.New("openpgp: exporting secret keyring isn't supported'")
	ErrKeyNotFound      = errors.New("openpgp: key not found")
	ErrInvalidPublicKey = errors.New("openpgp: invalid public key")
)
View Source
var (
	PubRingPath = DefaultPublicKeyRing
	SecRingPath = DefaultSecretKeyRing
)

Paths to the public and secret keyrings.

View Source
var DefaultConfig *packet.Config

Functions

func NewEntity

func NewEntity(name, email, outFile string) (ne *openpgp.Entity, err error)

NewEntity creates a new entity. It doesn't provide an option for comments.

func ParanoidDefaultConfig

func ParanoidDefaultConfig() *packet.Config

SaneDefaultConfig is a more secure default config than the defaults.

func SetKeyRingDir

func SetKeyRingDir(dir string)

Types

type KeyRing

type KeyRing struct {
	Entities map[string]*openpgp.Entity
	// contains filtered or unexported fields
}

A KeyRing contains a list of entities and the state required to maintain the key ring.

func LoadKeyRing

func LoadKeyRing(path string) (keyRing *KeyRing, err error)

LoadKeyRing reads the unarmoured keyring stored at the named path.

func (*KeyRing) Entity

func (keyRing *KeyRing) Entity(keyID string) (e *openpgp.Entity)

func (*KeyRing) Export

func (keyRing *KeyRing) Export(keyID string) (armoured string, err error)

Export writes out the named public key, or all public keys if keyID is empty. The result is an ASCII-armoured public key.

func (*KeyRing) Import

func (keyRing *KeyRing) Import(armoured string) (n int, err error)

Import imports an armoured public key block.

func (*KeyRing) Private

func (keyRing *KeyRing) Private() bool

Private returns true if the keyring contains secret key material.

func (*KeyRing) Sign

func (keyRing *KeyRing) Sign(message []byte, keyID string) (sig []byte, err error)

Sign signs the given message.

func (*KeyRing) Store

func (keyRing *KeyRing) Store() (err error)

Store writes the keyring to disk as an unarmoured keyring.

func (*KeyRing) Unlock

func (keyRing *KeyRing) Unlock(keyID string) (err error)

Unlock decrypts the secured key, reading the passphrase from the command line.

Jump to

Keyboard shortcuts

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