encryption

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptBytes

func DecryptBytes(encryptedMsg []byte, decKey []byte) ([]byte, error)

func EncryptBytes

func EncryptBytes(plaintext []byte, encrKey []byte) ([]byte, error)

func GenerateRandomKey

func GenerateRandomKey() ([]byte, error)

func NewNonce

func NewNonce() ([]byte, error)

Types

type DecryptStream

type DecryptStream struct {
	ChunkSize    int64
	MasterKey    []byte
	CipherKey    []byte
	Source       io.Reader
	SourceErr    error
	SourceBuffer *bytes.Buffer
}

func NewDecryptStream

func NewDecryptStream(masterKey []byte, encrCipherKey []byte, source io.Reader, chunkSize int64) (*DecryptStream, error)

func (*DecryptStream) AddPlaintext

func (stream *DecryptStream) AddPlaintext()

func (*DecryptStream) Read

func (stream *DecryptStream) Read(p []byte) (n int, err error)

type EncryptStream

type EncryptStream struct {
	ChunkSize    int64
	MasterKey    []byte
	CipherKey    []byte
	Nonce        NonceInc
	Source       io.Reader
	SourceErr    error
	SourceBuffer *bytes.Buffer
}

func NewEncryptStream

func NewEncryptStream(masterKey []byte, source io.Reader, chunkSize int64) (*EncryptStream, error)

func (*EncryptStream) AddCiphertext

func (stream *EncryptStream) AddCiphertext()

func (*EncryptStream) GetEncryptedCipherKey

func (stream *EncryptStream) GetEncryptedCipherKey() ([]byte, error)

func (*EncryptStream) Read

func (stream *EncryptStream) Read(p []byte) (n int, err error)

type NonceInc

type NonceInc struct {
	Base      []byte
	Increment int64
}

func NewNonceInc

func NewNonceInc() (NonceInc, error)

func (*NonceInc) Next

func (nonce *NonceInc) Next() []byte

Jump to

Keyboard shortcuts

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