aeadstream

package
v0.0.0-...-d8c5413 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2017 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package aeadstream implements streams on AEAD ciphers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AEADStream

type AEADStream struct {
	cipher.AEAD
	// contains filtered or unexported fields
}

AEADStream is a wrapper of cipher.AEAD.

func NewAEADStream

func NewAEADStream(c cipher.AEAD) *AEADStream

NewAEADStream creates an AEADStream based on c.

func (*AEADStream) StreamDecrypt

func (as *AEADStream) StreamDecrypt(w io.Writer, r io.Reader, nonceSeed []byte, chunkSize int) (int64, error)

StreamDecrypt decrypts data from r and writes plain text to w. cipher.AEAD.Open is processed every chunkSize of data read. nonceSeed is the seed of nonce, must either be nil or the same size as NonceSize() of the AEAD cipher.

The number of bytes written to w is returned. If and only if the returned error is nil, either reading from r or writing to w met EOF. It is guaranteed that unauthorized data is never written to w.

func (*AEADStream) StreamEncrypt

func (as *AEADStream) StreamEncrypt(w io.Writer, r io.Reader, nonceSeed []byte, chunkSize int) (int64, error)

StreamEncrypt encrypts data from r and writes cipher text to w. cipher.AEAD.Seal is processed every chunkSize of data read. nonceSeed is the seed of nonce, must either be nil or the same size as NonceSize() of the AEAD cipher.

The number of bytes written to w is returned. If and only if the returned error is nil, either reading from r or writing to w met EOF.

Jump to

Keyboard shortcuts

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