boxbuf

package module
v0.0.0-...-f595491 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 5 Imported by: 0

README

boxbuf

boxbuf is a library which enables support for asymmetric encryption with Reader and Writer streams, using NACL/box.

LICENSE

The MIT License (MIT)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecReader

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

DecReader is an io.Reader that can be used to decrypt data using a secret key. DecWriter uses golang.org/x/crypto/nacl/box to perform asymmetric decryption.

func NewReader

func NewReader(secretKey [32]byte, in io.Reader) (*DecReader, error)

NewReader creates a new DecReader using secretKey to decrypt the data as needed from in.

func (*DecReader) Read

func (b *DecReader) Read(p []byte) (int, error)

Read reads from the underlying io.Reader, decrypting bytes as needed, until len(p) byte have been read or the underlying stream is exhausted.

type EncWriter

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

EncWriter is an io.Writer that can be used to encrypt data with a peer's public key. EncWriter uses golang.org/x/crypto/nacl/box to perform asymmetric encryption.

func NewWriter

func NewWriter(peersPublicKey [32]byte, out io.Writer) (*EncWriter, error)

NewWriter intializes a new EncWriter using peersPublicKey to encrypt all data, writing the result to `out`.

func (*EncWriter) Write

func (w *EncWriter) Write(p []byte) (int, error)

Write writes the entirety of p to the underlying io.Writer, encrypting the data with the public key and chunking as needed.

Jump to

Keyboard shortcuts

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