keys

package
v0.0.0-...-122ae05 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: GPL-3.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// The encryption key size is set so it has the same entropy as the derived
	// key.
	EncryptionKeySize = 32

	// XXX: needs to be in sync with
	//      github.com/snapcore/secboot/crypto.go:"type RecoveryKey"
	// Size of the recovery key.
	RecoveryKeySize = 16

	// The auxiliary key is used to bind keys to models
	AuxKeySize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuxKey

type AuxKey [AuxKeySize]byte

AuxKey is the key to bind models to keys.

func NewAuxKey

func NewAuxKey() (AuxKey, error)

type EncryptionKey

type EncryptionKey []byte

EncryptionKey is the key used to encrypt the data partition.

func NewEncryptionKey

func NewEncryptionKey() (EncryptionKey, error)

func (EncryptionKey) Save

func (key EncryptionKey) Save(filename string) error

Save writes the key in the location specified by filename.

type KeyDataWriter

type KeyDataWriter interface {
	io.Writer
	Commit() error
}

KeyDataWriter is a the same as KeyDataWriter from github.com/canonical/secboot.

type PlainKey

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

PlainKey is a wrapper for a secboot KeyData representing a plainkey.

func (*PlainKey) Write

func (key *PlainKey) Write(writer KeyDataWriter) error

Write writes a PlainKey to a KeyDataWriter.

type ProtectorKey

type ProtectorKey []byte

ProtectorKey is a key that can be used to protect "plainkey" keys.

func NewProtectorKey

func NewProtectorKey() (ProtectorKey, error)

NewProtectorKey creates a new random ProtectorKey.

func (ProtectorKey) CreateProtectedKey

func (key ProtectorKey) CreateProtectedKey(primaryKey []byte) (*PlainKey, []byte, []byte, error)

CreateProtectedKey creates a protected key for a given ProtectorKey and primary key. It returns a the protected key wrapped as a PlainKey as well the used primary key and the unlock key. If primaryKey is nil, the primary key will be generated.

func (ProtectorKey) SaveToFile

func (key ProtectorKey) SaveToFile(path string) error

SaveToFile saves the ProtectorKey to a file at given path.

type RecoveryKey

type RecoveryKey [RecoveryKeySize]byte

RecoveryKey is a key used to unlock the encrypted partition when the encryption key can't be used, for example when unseal fails.

func NewRecoveryKey

func NewRecoveryKey() (RecoveryKey, error)

func RecoveryKeyFromFile

func RecoveryKeyFromFile(recoveryKeyFile string) (*RecoveryKey, error)

func (RecoveryKey) Save

func (key RecoveryKey) Save(filename string) error

Save writes the recovery key in the location specified by filename.

func (RecoveryKey) String

func (k RecoveryKey) String() string

Jump to

Keyboard shortcuts

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