assuan

package
v6.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOk      = "OK"
	StatusErr     = "ERR"
	StatusInquire = "INQUIRE"
	StatusData    = "D"
	StatusLines   = "S"
	StatusComment = "#"
)

Variables

View Source
var InquireCancel = errors.New("inquiry cancelled")
View Source
var InvalidCsExp = errors.New("invalid cs-exp")

Functions

This section is empty.

Types

type Conn

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

func Dial

func Dial(path string) (*Conn, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Transact

func (c *Conn) Transact(command string, inquire InquireFunc) (res Response, err error)

Execute a command and retrieve the result.

If an INQUIRE is received then inquire() will be invoked with the text after INQUIRE and all status lines received so far. It should return data to send, or it can return an err of InquireCancel which will cause a CANCEL to be sent and the resulting response to be returned. If inquire is nil then a CANCEL is always sent.

type InquireFunc

type InquireFunc func(inquireLine string, msgLines []string) (string, error)

type Response

type Response struct {
	Status        string
	StatusMessage string
	Lines         []string
	Blob          []byte
}

func (Response) Error

func (r Response) Error() string

type ScdConn

type ScdConn struct {
	Conn
	Serial string
}

func DialScd

func DialScd(path string) (*ScdConn, error)

func (*ScdConn) CheckPin

func (s *ScdConn) CheckPin(pin string) error

Verify that the token can be unlocked with the given pin

func (*ScdConn) Learn

func (s *ScdConn) Learn() ([]*ScdKey, error)

Invoke LEARN and return info about the keys in the token

type ScdKey

type ScdKey struct {
	Serial      string
	Fingerprint string
	KeyGrip     string
	KeyId       string
	// contains filtered or unexported fields
}

func (*ScdKey) Public

func (k *ScdKey) Public() (crypto.PublicKey, error)

Get the public key from the token

func (*ScdKey) Sign

func (k *ScdKey) Sign(hashValue []byte, opts crypto.SignerOpts, pin string) ([]byte, error)

Create a signature over the given (unpadded) digest.

Jump to

Keyboard shortcuts

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