crypto

package
v0.0.0-...-04b4a7a Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0-only Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// flag to select DCP for on supported block ciphers
	DCP = true
	// flag to allow DCP, when flagged, for XTS computation
	DCPXTS = false
	// flag to select DCP for ESSIV computation
	DCPIV = false

	// key derivation iteration count
	PBKDF2_ITER = 4096

	// DEK key derivation diversifier
	DEK_DIV = "floppyDEK"
	// ESSIV key derivation diversifier
	ESSIV_DIV = "floppyESSIV"
	// SNVS key derivation diversifier
	SNVS_DIV = "floppySNVS"
)
View Source
const (
	MMC_CONF_BLOCK = 2097152
	CONF_BLOCKS_V1 = 2
	CONF_BLOCKS_V2 = 2048
)
View Source
const (
	BLOCK_KEY = iota
	ESSIV_KEY
	SNVS_KEY
)

DCP key RAM indices

View Source
const (
	UA_LONGTERM_KEY = iota
	UA_EPHEMERAL_KEY
	MD_LONGTERM_KEY
	MD_EPHEMERAL_KEY
)

BLE key indices

Variables

View Source
var ESSIV = false

flag to select ESSIV on AES-128 CBC ciphers

Functions

func Rand

func Rand(n int) []byte

Types

type Keyring

type Keyring struct {
	// FDE function
	Cipher func(buf []byte, lba int, blocks int, blockSize int, enc bool, wg *sync.WaitGroup)

	// Configuration instance
	Conf *PersistentConfiguration

	// long term BLE peer authentication keys
	ArmoryLongterm *ecdsa.PrivateKey
	MobileLongterm *ecdsa.PublicKey
	// contains filtered or unexported fields
}

func (*Keyring) ClearSessionKeys

func (k *Keyring) ClearSessionKeys()

func (*Keyring) DecryptOFB

func (k *Keyring) DecryptOFB(ciphertext []byte) (plaintext []byte, err error)

func (*Keyring) EncryptOFB

func (k *Keyring) EncryptOFB(plaintext []byte) (ciphertext []byte, err error)

func (*Keyring) Export

func (k *Keyring) Export(index int, private bool) ([]byte, error)

func (*Keyring) Import

func (k *Keyring) Import(index int, private bool, der []byte) (err error)

func (*Keyring) Init

func (k *Keyring) Init(overwrite bool) (err error)

func (*Keyring) Load

func (k *Keyring) Load() (err error)

func (*Keyring) NewLongtermKey

func (k *Keyring) NewLongtermKey() (err error)

func (*Keyring) NewSessionKeys

func (k *Keyring) NewSessionKeys(nonce []byte) (err error)

func (*Keyring) Save

func (k *Keyring) Save() (err error)

func (*Keyring) SetCipher

func (k *Keyring) SetCipher(kind api.Cipher, diversifier []byte) (err error)

func (*Keyring) SignECDSA

func (k *Keyring) SignECDSA(data []byte, ephemeral bool) (sig *api.Signature, err error)

func (*Keyring) VerifyECDSA

func (k *Keyring) VerifyECDSA(data []byte, sig *api.Signature, ephemeral bool) (err error)

type PersistentConfiguration

type PersistentConfiguration struct {
	// serialized long term BLE peer authentication keys
	ArmoryLongterm []byte
	MobileLongterm []byte

	// BLE API Configuration
	Settings *api.Configuration

	// Transparency Log Checkpoint
	ProofBundle *logapi.ProofBundle
}

Jump to

Keyboard shortcuts

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