streaming

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package streaming contains Writer and Reader implementing Crypt4GH encryption and decryption correspondingly.

Package streaming contains writer and reader implementing Crypt4GH encryption and decryption correspondingly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReCrypt4GHWriter added in v1.6.0

func ReCrypt4GHWriter(reader io.Reader, readerPrivateKey [chacha20poly1305.KeySize]byte, readerPublicKeyList [][chacha20poly1305.KeySize]byte) (io.Reader, error)

ReCrypt4GHWriter re-encrypts a file by first re-encrypting the header and then attaching the new header to the file. The header is decrypted with a known key and re-encrypted for the new recievers. We keep reading the header and re-encrypting it separately so that ReEncryptHeader can be used independently

Types

type Crypt4GHReader

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

Crypt4GHReader structure keeps the structure for the internal implementation, providing methods for io.Reader, io.ByteReader, io.Seeker, io.Closer.

func NewCrypt4GHReader

func NewCrypt4GHReader(reader io.Reader, readerPrivateKey [chacha20poly1305.KeySize]byte, dataEditList *headers.DataEditListHeaderPacket) (*Crypt4GHReader, error)

NewCrypt4GHReader method constructs streaming.Crypt4GHReader instance from io.Reader and corresponding key. Allows for overriding data edit list from stream, returns the struct pointer or nil and any error encountered.

func (*Crypt4GHReader) Close added in v1.8.1

func (c *Crypt4GHReader) Close() (err error)

Close method implements io.Closer.Close for the Crypt4GHReader.

func (*Crypt4GHReader) Discard

func (c *Crypt4GHReader) Discard(skip int) (n int, err error)

Discard advances the stream without returning the data, returns the skipped amount and possible error encountered.

func (*Crypt4GHReader) GetHeader

func (c *Crypt4GHReader) GetHeader() []byte

GetHeader method returns the bytes for the Crypt4GH header for the current stream.

func (*Crypt4GHReader) Read

func (c *Crypt4GHReader) Read(p []byte) (n int, err error)

Read method implements io.Reader.Read for the Crypt4GHReader.

func (*Crypt4GHReader) ReadByte

func (c *Crypt4GHReader) ReadByte() (byte, error)

ReadByte method implements io.ByteReader.ReadByte for the Crypt4GHReader.

func (*Crypt4GHReader) Seek added in v1.8.1

func (c *Crypt4GHReader) Seek(offset int64, whence int) (pos int64, err error)

Seek method implements io.Seeker.Seek for the Crypt4GHReader.

type Crypt4GHWriter

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

Crypt4GHWriter structure implements io.WriteCloser and io.ByteWriter.

func NewCrypt4GHWriter

func NewCrypt4GHWriter(writer io.Writer, writerPrivateKey [chacha20poly1305.KeySize]byte, readerPublicKeyList [][chacha20poly1305.KeySize]byte, dataEditList *headers.DataEditListHeaderPacket) (*Crypt4GHWriter, error)

NewCrypt4GHWriter method constructs streaming.Crypt4GHWriter instance from io.Writer and corresponding keys.

func NewCrypt4GHWriterWithoutPrivateKey

func NewCrypt4GHWriterWithoutPrivateKey(writer io.Writer, readerPublicKeyList [][chacha20poly1305.KeySize]byte, dataEditList *headers.DataEditListHeaderPacket) (*Crypt4GHWriter, error)

NewCrypt4GHWriter method constructs streaming.Crypt4GHWriter instance from io.Writer and reader's public key. Writer's public key is generated automatically.

func (*Crypt4GHWriter) Close

func (c *Crypt4GHWriter) Close() error

Close method implements io.Closer.Close.

func (*Crypt4GHWriter) Write

func (c *Crypt4GHWriter) Write(p []byte) (n int, err error)

Write method implements io.Writer.Write.

func (*Crypt4GHWriter) WriteByte

func (c *Crypt4GHWriter) WriteByte(b byte) error

WriteByte method implements io.ByteWriter.WriteByte.

Jump to

Keyboard shortcuts

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