stream

package
v0.0.0-...-f70127e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFile

func DecryptFile(src, dst, key, macKey string) error

func EncryptFile

func EncryptFile(src, dst, key, macKey string) error

Types

type StreamDecrypter

type StreamDecrypter struct {
	Source io.Reader
	Block  cipher.Block
	Stream cipher.Stream
	MAC    hash.Hash
	Meta   StreamMeta
}

Stream Decrypter is a decrypter for a stream of data with authentication

func NewStreamDecrypter

func NewStreamDecrypter(key, macKey []byte, meta StreamMeta, cipherText io.Reader) (*StreamDecrypter, error)

Creates a new StreamDecrypter

func (*StreamDecrypter) Authenticate

func (s *StreamDecrypter) Authenticate() error

Verifies that the hash of the stream is correct. This should only be called after the processing is finished

func (*StreamDecrypter) Read

func (s *StreamDecrypter) Read(p []byte) (int, error)

Reads the byte from the reader and decrypts them

type StreamEncrypter

type StreamEncrypter struct {
	Source io.Reader
	Block  cipher.Block
	Stream cipher.Stream
	MAC    hash.Hash
	IV     []byte
}

Stream Encrypter is an encrypter for a stream of data with authentication

func NewStreamEncrypter

func NewStreamEncrypter(key, macKey []byte, plainText io.Reader) (*StreamEncrypter, error)

Creates a new Stream Encrypter

func (*StreamEncrypter) Meta

func (s *StreamEncrypter) Meta() StreamMeta

Returns the encrypted streams metadata for use in decrypting. This should be called after the stream is finished

func (*StreamEncrypter) Read

func (s *StreamEncrypter) Read(p []byte) (int, error)

Encrypts the bytes of the Source reader and and places them into p

type StreamMeta

type StreamMeta struct {
	//	Initialization Vector for the cryptographic function
	IV []byte
	//	HMAC hash of the stream
	Hash []byte
}

Metadata about the encrypted stream

Jump to

Keyboard shortcuts

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