assuan

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

Generate sample ECC key like so

gpg --full-gen-key --expert
# select ECC sign only
# use e.g. Name: foo bar, Email: foo@example.com

Generate signing traces like so:

echo foo | strace -xs 1024 /usr/bin/gpg --verbose --status-fd=2 -bsau C54A8868468BC138 2> gpg-agent.sign.strace
# grep the agent socket
grep '(5' 
# reads
grep '^read' 
# writes
grep '^write' 

Export key for use in CI:

gpg --export -ao /tmp/C54A8868468BC138.asc foo@example.com

Documentation

Overview

Package assuan implements an libgcrypt Assuan protocol server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventStrings

func EventStrings() []string

EventStrings returns a slice of all String values of the enum

func PercentDecodeSExp added in v0.9.0

func PercentDecodeSExp(data []byte) []byte

PercentDecodeSExp replaces the percent-encoded byte sequences with their raw byte values.

func PercentEncodeSExp added in v0.9.0

func PercentEncodeSExp(data []byte) []byte

PercentEncodeSExp replaces the raw byte values with their percent-encoded byte sequences.

func StateStrings

func StateStrings() []string

StateStrings returns a slice of all String values of the enum

Types

type Assuan

type Assuan struct {
	fsm.Machine
	// contains filtered or unexported fields
}

Assuan is the Assuan protocol FSM.

func New

func New(rw io.ReadWriter, log *zap.Logger, n *notify.Notify,
	ks ...KeyService) *Assuan

New initialises a new gpg-agent server assuan FSM. It returns a *fsm.Machine configured in the ready state.

func (*Assuan) Occur

func (a *Assuan) Occur(e Event, data ...[]byte) error

Occur handles an event occurrence.

func (*Assuan) Run

func (a *Assuan) Run(ctx context.Context) error

Run the event machine loop

type Event

type Event fsm.Event

Event represents an Assuan event.

func EventString

func EventString(s string) (Event, error)

EventString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func EventValues

func EventValues() []Event

EventValues returns all values of the enum

func (Event) IsAEvent

func (i Event) IsAEvent() bool

IsAEvent returns "true" if the value is listed in the enum definition. "false" otherwise

func (Event) MarshalText

func (i Event) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Event

func (Event) String

func (i Event) String() string

func (*Event) UnmarshalText

func (i *Event) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Event

type KeyService added in v0.4.0

type KeyService interface {
	Name() string
	HaveKey([][]byte) (bool, []byte, error)
	Keygrips() ([][]byte, error)
	GetSigner([]byte) (crypto.Signer, error)
	GetDecrypter([]byte) (crypto.Decrypter, error)
}

The KeyService interface provides functions used by the Assuan FSM.

type State

type State fsm.State

State represents an Assuan state.

func StateString

func StateString(s string) (State, error)

StateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StateValues

func StateValues() []State

StateValues returns all values of the enum

func (State) IsAState

func (i State) IsAState() bool

IsAState returns "true" if the value is listed in the enum definition. "false" otherwise

func (State) MarshalText

func (i State) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for State

func (State) String

func (i State) String() string

func (*State) UnmarshalText

func (i *State) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for State

Jump to

Keyboard shortcuts

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