crypt

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedCryptsetupVersion is the error raised when the available version
	// of cryptsetup is not compatible with the Apptainer encryption mechanism.
	ErrUnsupportedCryptsetupVersion = errors.New("installed version of cryptsetup is not supported, >=2.0.0 required")

	// ErrInvalidPassphrase raised when the passed key is not valid to open requested
	// encrypted device.
	ErrInvalidPassphrase = errors.New("no key available with this passphrase")
)

Pre-defined error(s)

Functions

This section is empty.

Types

type Device

type Device struct{}

Device describes a crypt device

func (*Device) CloseCryptDevice

func (crypt *Device) CloseCryptDevice(path string) error

CloseCryptDevice closes the crypt device

func (*Device) EncryptFilesystem

func (crypt *Device) EncryptFilesystem(path string, key []byte, tempdir string) (string, error)

EncryptFilesystem takes the path to a file containing a non-encrypted filesystem, encrypts it using the provided key, and returns a path to a file that can be later used as an encrypted volume with cryptsetup. NOTE: it is the callers responsibility to remove the returned file that contains the crypt header.

func (*Device) Open

func (crypt *Device) Open(key []byte, path string) (string, error)

Open opens the encrypted filesystem specified by path (usually a loop device, but any encrypted block device will do) using the given key and returns the name assigned to it that can be later used to close the device.

Jump to

Keyboard shortcuts

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