ctrutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package ctrutil contains various utilities used by ctrsigcheck.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeUTF16

func DecodeUTF16(src []byte, order binary.ByteOrder) string

DecodeUTF16 string from the given bytes using the given ByteOrder.

func NewCipherReader

func NewCipherReader(src io.Reader, blockMode cipher.BlockMode) io.Reader

NewCipherReader wraps the given Reader to add on-the-fly encryption or decryption using the given BlockMode.

The input must be aligned to the cipher block size: ErrUnexpectedEOF is returned if EOF is reached in the middle of a block.

This Reader limits buffering and copies to the minimum: lookahead can only happen if the last requested block is incomplete. In that case, it is guaranteed that the wrapped Reader is never read beyond the end of the incomplete block. In particular, it is safe to stop reading from this Reader at a block boundary and then start using the wrapped Reader for something else.

Types

type Reader

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

Reader wraps another Reader to add some capabilities.

func NewReader

func NewReader(inner io.Reader) *Reader

NewReader wraps the given Reader to add some capabilities.

func (*Reader) Discard

func (r *Reader) Discard(n int64) error

Discard the next n bytes.

Returns ErrUnexpectedEOF is EOF has been reached prematurely.

func (*Reader) Err

func (r *Reader) Err() error

Err that has been returned by the last Read.

func (*Reader) Offset

func (r *Reader) Offset() int64

Offset of the next byte to be read.

func (*Reader) Read

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

Jump to

Keyboard shortcuts

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