libsodium

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrypterFromKey

func CrypterFromKey(key string) crypto.Crypter

CrypterFromKey creates Crypter from key

func CrypterFromKeyPath

func CrypterFromKeyPath(path string) crypto.Crypter

CrypterFromKeyPath creates Crypter from key path

func NewReader

func NewReader(reader io.Reader, key []byte) io.Reader

NewReader creates Reader from ordinary reader and key

func NewWriter

func NewWriter(writer io.Writer, key []byte) io.WriteCloser

NewWriter creates Writer from ordinary writer and key

Types

type Crypter

type Crypter struct {
	Key     string
	KeyPath string
	// contains filtered or unexported fields
}

Crypter is libsodium Crypter implementation

func (*Crypter) Decrypt

func (crypter *Crypter) Decrypt(reader io.Reader) (io.Reader, error)

Decrypt creates decrypted reader from ordinary reader

func (*Crypter) Encrypt

func (crypter *Crypter) Encrypt(writer io.Writer) (io.WriteCloser, error)

Encrypt creates encryption writer from ordinary writer

type Reader

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

Reader wraps ordinary reader with libsodium decryption

func (*Reader) Read

func (reader *Reader) Read(p []byte) (n int, err error)

Read implements io.Reader

type Writer

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

Writer wraps ordinary writer with libsodium encryption

func (*Writer) Close

func (writer *Writer) Close() (err error)

Close implements io.Closer

func (*Writer) Write

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

Write implements io.Writer

Jump to

Keyboard shortcuts

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