agent

package
v0.0.0-...-6c38496 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownFormat = errors.New("s-expression is in unknown format")
	ErrNotPublicKey  = errors.New("s-expression is not a public key")
	ErrNotSignature  = errors.New("s-expression is not a signature")
)

These errors may be returned from the functions related to s-expression encoding and decoding.

Functions

This section is empty.

Types

type Conn

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

Conn represents a single connection to a GPG agent.

func Dial

func Dial(filename string, options []string) (*Conn, error)

Dial connects to the specified unix domain socket and checks if there is a live GPG agent on the other end.

func (*Conn) Close

func (conn *Conn) Close() error

Close this connection.

func (*Conn) Key

func (conn *Conn) Key(keygrip string) (Key, error)

Key returns the key information for the key with the specified keygrip.

func (*Conn) Keys

func (conn *Conn) Keys() ([]Key, error)

Keys returns a list of available keys.

func (*Conn) Raw

func (conn *Conn) Raw(f ResponseFunc, format string, a ...interface{}) error

Raw executes a command and pipes its results to the specified ResponseFunc parameter.

func (*Conn) ReadKey

func (conn *Conn) ReadKey(keygrip string) (crypto.PublicKey, error)

ReadKey returns the public key for the key with the specified keygrip.

func (*Conn) Version

func (conn *Conn) Version() (string, error)

Version returns the version number of gpg-agent.

type Error

type Error struct {
	Code        int
	Description string
}

Error describes a gpg-agent error.

func NewError

func NewError(line string) Error

NewError parses a gpg-agent error.

func (Error) Error

func (e Error) Error() string

Error implements the error interface.

type Key

type Key struct {
	Keygrip     string
	Type        KeyType
	SerialNo    string
	CardID      string
	Cached      bool
	Protection  KeyProtection
	Fingerprint string
	TimeToLive  string
	// contains filtered or unexported fields
}

Key describes the information gpg-agent exposes about a key.

func (Key) Decrypt

func (key Key) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error)

Decrypt decrypts ciphertext with this key. If opts is nil or of type *PKCS1v15DecryptOptions then PKCS#1 v1.5 decryption is performed. Otherwise opts must have type *OAEPOptions and OAEP decryption is done.

This function is basically a copy of rsa.Decrypt().

func (Key) Public

func (key Key) Public() crypto.PublicKey

Public returns this key's public key.

func (Key) Sign

func (key Key) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) (signature []byte, err error)

Sign signs msg with this key, possibly using entropy from rand. If opts is a *PSSOptions then the PSS algorithm will be used, otherwise PKCS#1 v1.5 will be used.

This function is basically a copy of rsa.Sign().

type KeyProtection

type KeyProtection int

KeyProtection describes the key project type.

const (
	ProtByPassphrase KeyProtection = iota
	ProtByNothing
	ProtUnknown
)

These constants define the possible KeyProtection values.

type KeyType

type KeyType int

KeyType describes the type of the key.

const (
	StoredOnDisk KeyType = iota
	StoredOnCard
	StoredUnknown
	StoredMissing
)

These constants define the possible KeyType values.

type ResponseFunc

type ResponseFunc func(respType, data string) error

ResponseFunc defines the function handler for the Raw function.

Directories

Path Synopsis
internal
rsa

Jump to

Keyboard shortcuts

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