idkey

package
v1.32.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

idkey supplies an identity key for a machine, container or device. This package provides an implementation based on an Ed25519 based key, currently only supporting a file based key storage solution. This can later be extended to support more secure hardware backed keystores, such as TPM, OP-TEE or YubiKey.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDKey

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

func Generate

func Generate(keyDir string) (*IDKey, error)

Generate generates a new identity key and persists it to disk. This function should only ever be called on the first boot otherwise the existing identity will be overwritten.

This function is equivalent to running:

openssl genpkey -algorithm Ed25519 -out key.pem

func Get

func Get(keyDir string) (*IDKey, error)

Get checks if an existing private identity key exists, and loads the key if it does. It creates a new private identity key and persists it to disk if no key was found. Cases where explicit control is desired on when to generate or load can use Generate and Load directly.

func Load

func Load(keyDir string) (*IDKey, error)

Load loads an existing identity key from disk.

func (*IDKey) Fingerprint

func (k *IDKey) Fingerprint() string

Fingerprint returns the identity fingerprint. This is the SHA512/384 hash of the public key, encoded in base32 (without padding). This is a convenient shorthand form of the identity that can be used to identify a specfic machine or device.

func (*IDKey) Public

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

Public implements part of the crypto.Signer interface.

func (*IDKey) Sign

func (k *IDKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)

Sign implements part of the crypto.Signer interface.

Jump to

Keyboard shortcuts

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