encryption

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: MPL-2.0 Imports: 1 Imported by: 1

Documentation

Overview

Package encryption provides abstraction level for various disk encryption methods.

Index

Constants

View Source
const (
	// LUKS2 encryption.
	LUKS2 = "luks2"
	// Unknown unecrypted or unsupported encryption.
	Unknown = "unknown"
)
View Source
const AnyKeyslot = -1

AnyKeyslot tells providers to pick any keyslot.

Variables

View Source
var ErrDeviceBusy = fmt.Errorf("mapped device is still in use")

ErrDeviceBusy returned when mapped device is still in use.

View Source
var ErrEncryptionKeyRejected = fmt.Errorf("encryption key rejected")

ErrEncryptionKeyRejected triggered when encryption key does not match.

Functions

This section is empty.

Types

type Key

type Key struct {
	Value []byte
	Slot  int
}

Key represents a single key.

func NewKey

func NewKey(slot int, value []byte) *Key

NewKey create a new key.

type Keyslot

type Keyslot struct {
	Type    string `json:"type"`
	KeySize int64  `json:"key_size"`
}

Keyslot represents a single LUKS2 keyslot.

type Keyslots

type Keyslots struct {
	Keyslots map[string]*Keyslot `json:"keyslots"`
}

Keyslots represents LUKS2 keyslots metadata.

type Provider

type Provider interface {
	Encrypt(devname string, key *Key) error
	Open(devname string, key *Key) (string, error)
	Close(devname string) error
	AddKey(devname string, key, newKey *Key) error
	SetKey(devname string, key, newKey *Key) error
	CheckKey(devname string, key *Key) (bool, error)
	RemoveKey(devname string, slot int, key *Key) error
	ReadKeyslots(deviceName string) (*Keyslots, error)
}

Provider represents encryption utility methods.

Directories

Path Synopsis
Package luks provides a way to call LUKS2 cryptsetup.
Package luks provides a way to call LUKS2 cryptsetup.

Jump to

Keyboard shortcuts

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