cypher

package
v4.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: BSD-2-Clause, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cypher

type Cypher struct {
	*Manager
	// contains filtered or unexported fields
}

Cypher contains the cryptographic and identifying information needed to decrypt a file part and associate it with the correct file.

func (Cypher) Decrypt

func (c Cypher) Decrypt(msg format.Message) ([]byte, error)

Decrypt decrypts the content of the message.

func (Cypher) Encrypt

func (c Cypher) Encrypt(contents []byte) (
	cipherText, mac []byte, fp format.Fingerprint)

Encrypt encrypts the file part contents and returns them along with a MAC and fingerprint.

func (Cypher) GetFingerprint

func (c Cypher) GetFingerprint() format.Fingerprint

GetFingerprint generates and returns the fingerprints.

type Manager

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

Manager the creation

func LoadManager

func LoadManager(kv versioned.KV) (*Manager, error)

LoadManager loads the Manager from storage.

func NewManager

func NewManager(key *ftCrypto.TransferKey, numFps uint16, disableKV bool,
	kv versioned.KV) (*Manager, error)

NewManager returns a new cypher Manager initialised with the given number of fingerprints.

func (*Manager) Delete

func (m *Manager) Delete() error

Delete removes all saved entries from storage.

func (*Manager) GetKey

func (m *Manager) GetKey() *ftCrypto.TransferKey

GetKey returns the transfer key used for encrypting/decrypting.

func (*Manager) GetUnusedCyphers

func (m *Manager) GetUnusedCyphers() []Cypher

GetUnusedCyphers returns a list of cyphers with unused fingerprint numbers.

func (*Manager) PopCypher

func (m *Manager) PopCypher() (Cypher, error)

PopCypher returns a new Cypher with next available fingerprint number. This marks the fingerprint as used. Returns false if no more fingerprints are available.

Jump to

Keyboard shortcuts

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