cypher

package
v4.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 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, 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) GetUnusedCyphers

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

GetUnusedCyphers returns a list of cyphers with unused fingerprints 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