piv

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECDHKey added in v0.9.0

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

ECDHKey implements ECDH using an underlying ECDSA key.

func (*ECDHKey) Decrypt added in v0.9.0

func (k *ECDHKey) Decrypt(_ io.Reader, sexp []byte,
	_ crypto.DecrypterOpts) ([]byte, error)

Decrypt performs ECDH as per gpg-agent.

func (*ECDHKey) Public added in v0.9.0

func (k *ECDHKey) Public() crypto.PublicKey

Public implements the other required method of the crypto.Decrypter and crypto.Signer interfaces.

type KeyService

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

KeyService represents a collection of tokens and slots accessed by the Personal Identity Verifaction card interface.

func New

func New(l *zap.Logger) *KeyService

New constructs a PIV and returns it.

func (*KeyService) GetDecrypter

func (p *KeyService) GetDecrypter(keygrip []byte) (crypto.Decrypter, error)

GetDecrypter returns a crypto.Decrypter associated with the given keygrip.

func (*KeyService) GetSigner

func (p *KeyService) GetSigner(keygrip []byte) (crypto.Signer, error)

GetSigner returns a crypto.Signer associated with the given keygrip.

func (*KeyService) HaveKey

func (p *KeyService) HaveKey(keygrips [][]byte) (bool, []byte, error)

HaveKey takes a list of keygrips, and returns a boolean indicating if any of the given keygrips were found, the found keygrip, and an error, if any.

func (*KeyService) Keygrips added in v0.9.0

func (p *KeyService) Keygrips() ([][]byte, error)

Keygrips returns a single slice of concatenated keygrip byteslices - one for each cryptographic key available on the keyservice.

func (*KeyService) Name

func (*KeyService) Name() string

Name returns the name of the keyservice.

func (*KeyService) SecurityKeys

func (p *KeyService) SecurityKeys() ([]SecurityKey, error)

SecurityKeys returns a slice containing all available security keys.

type SecurityKey

type SecurityKey interface {
	AttestationCertificate() (*x509.Certificate, error)
	Card() string
	Close() error
	Comment(*securitykey.SlotSpec) string
	PrivateKey(*securitykey.CryptoKey) (crypto.PrivateKey, error)
	SigningKeys() []securitykey.SigningKey
	CryptoKeys() []securitykey.CryptoKey
	StringsGPG(string, string) ([]string, error)
	StringsSSH() []string
}

SecurityKey is a simple interface for security keys allowing abstraction over the securitykey implementation, and allowing generation of mocks for testing.

Jump to

Keyboard shortcuts

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