securitykey

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotReset = errors.New("security key already set up")

ErrNotReset is returned from Setup when the security key is already set up and reset is false.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	openpgp.Entity
	SigningKey
}

Entity wraps a synthesized openpgp.Entity and associates it with a SigningKey.

type SecurityKey

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

A SecurityKey is a physical hardware token which implements PIV, such as a Yubikey. It provides a convenient abstraction around the low-level piv.YubiKey object.

func New

func New(card string) (*SecurityKey, error)

New returns a security key identified by card string.

func (*SecurityKey) AttestationCertificate

func (k *SecurityKey) AttestationCertificate() (*x509.Certificate, error)

AttestationCertificate returns the attestation certificate of the underlying yubikey.

func (*SecurityKey) Card

func (k *SecurityKey) Card() string

Card returns the card identifier.

func (*SecurityKey) Close

func (k *SecurityKey) Close() error

Close closes the underlying yubikey.

func (*SecurityKey) Comment added in v0.4.0

func (k *SecurityKey) Comment(ss *SlotSpec) string

Comment returns a comment suitable for e.g. the SSH public key format

func (*SecurityKey) PrivateKey

func (k *SecurityKey) PrivateKey(s *SigningKey) (crypto.PrivateKey, error)

PrivateKey returns the private key of the given public signing key.

func (*SecurityKey) Retries

func (k *SecurityKey) Retries() (int, error)

Retries returns the number of attempts remaining to enter the correct PIN.

func (*SecurityKey) Serial

func (k *SecurityKey) Serial() uint32

Serial returns the serial number of the SecurityKey.

func (*SecurityKey) Setup

func (k *SecurityKey) Setup(pin, version string, reset bool) error

Setup configures the SecurityKey to work with piv-agent.

func (*SecurityKey) SigningKeys

func (k *SecurityKey) SigningKeys() []SigningKey

SigningKeys returns the slice of signing keys held by the SecurityKey.

func (*SecurityKey) StringsGPG

func (k *SecurityKey) StringsGPG(name, email string) ([]string, error)

StringsGPG returns an array of commonly formatted GPG keys as strings.

func (*SecurityKey) StringsSSH

func (k *SecurityKey) StringsSSH() []string

StringsSSH returns an array of commonly formatted SSH keys as strings.

type SigningKey

type SigningKey struct {
	SlotSpec *SlotSpec
	Public   crypto.PublicKey
	PubSSH   ssh.PublicKey
	PubPGP   *packet.PublicKey
}

SigningKey is a public signing key on a security key / hardware token.

type SlotSpec

type SlotSpec struct {
	Slot        piv.Slot
	TouchPolicy piv.TouchPolicy
}

SlotSpec represents a combination of slot and touch policy on the token.

Jump to

Keyboard shortcuts

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