xcp

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyLength = chacha20poly1305.KeySize

	CipherTextMinLength = nonceLength + chacha20poly1305.Overhead
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

type SymmetricCipher

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

SymmetricCipher is a wrapper around the AEAD interface from the golang.org/x/crypto/chacha20poly1305 package.

func New

func New(key []byte) (*SymmetricCipher, error)

New returns a new Cipher instance. If a Cipher instance with the same key has already been created, it will be returned instead.

func (*SymmetricCipher) NewDecryptingReader

func (cipher *SymmetricCipher) NewDecryptingReader(src io.Reader) (io.Reader, error)

NewDecryptingReader returns a new io.Reader that decrypts src with the cipher

func (*SymmetricCipher) NewEncryptingWriter

func (cipher *SymmetricCipher) NewEncryptingWriter(dst io.Writer, compress bool) (io.WriteCloser, error)

NewEncryptingWriter returns a new io.WriteCloser that encrypts data with the cipher and writes to dst.

type Writer

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

func (*Writer) Close

func (w *Writer) Close() error

Close flushes the last chunk. It does not close the underlying Writer.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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