crypt

package
v0.0.0-...-6b36e67 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEncryptedFileTooShort  = errors.New("file is too short to be encrypted")
	ErrorEncryptedFileBadHeader = errors.New("file has truncated block header")
	ErrorEncryptedBadMagic      = errors.New("not an encrypted file - bad magic string")
	ErrorFileClosed             = errors.New("file already closed")
	ErrorBadSeek                = errors.New("Seek beyond end of file")
)

Functions

func DecryptedSize

func DecryptedSize(size int64) (int64, error)

func EncryptedSize

func EncryptedSize(size int64) int64

Types

type Cipher

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

func NewCipher

func NewCipher(password, salt string) (*Cipher, error)

func (*Cipher) DecryptData

func (c *Cipher) DecryptData(rc io.ReadCloser) (io.ReadCloser, error)

func (*Cipher) DecryptDataSeek

func (c *Cipher) DecryptDataSeek(ctx context.Context, open OpenRangeSeek, offset, limit int64) (ReadSeekCloser, error)

func (*Cipher) EncryptData

func (c *Cipher) EncryptData(in io.Reader) (io.ReadCloser, error)

func (*Cipher) Key

func (c *Cipher) Key(password, salt string) (err error)

type OpenRangeSeek

type OpenRangeSeek func(ctx context.Context, offset, limit int64) (io.ReadCloser, error)

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

Jump to

Keyboard shortcuts

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