encryption

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

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

Go to latest
Published: Feb 20, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decrypter

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

Decrypter allows decrypt payload of encrypted object.

func NewDecrypter

func NewDecrypter(p Params, encryptedObjectSize uint64, r *Range) (*Decrypter, error)

NewDecrypter creates decrypter for regular encrypted object.

func NewMultipartDecrypter

func NewMultipartDecrypter(p Params, decryptedObjectSize uint64, partsSizes []uint64, r *Range) (*Decrypter, error)

NewMultipartDecrypter creates new decrypted that can decrypt multipart object that contains concatenation of encrypted parts.

func (Decrypter) DecryptedLength

func (d Decrypter) DecryptedLength() uint64

DecryptedLength is actual (decrypted) length of data.

func (Decrypter) EncryptedLength

func (d Decrypter) EncryptedLength() uint64

EncryptedLength is size of encrypted data that should be read for successful decryption.

func (Decrypter) EncryptedOffset

func (d Decrypter) EncryptedOffset() uint64

EncryptedOffset is offset of encrypted payload for successful decryption.

func (*Decrypter) Read

func (d *Decrypter) Read(p []byte) (int, error)

Read implements io.Reader.

func (*Decrypter) SetReader

func (d *Decrypter) SetReader(r io.Reader) error

SetReader sets encrypted payload reader that should be decrypted. Must be invoked before any read.

type ObjectEncryption

type ObjectEncryption struct {
	Enabled   bool
	Algorithm string
	HMACKey   string
	HMACSalt  string
}

ObjectEncryption stores parsed object encryption headers.

type Params

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

Params contains encryption key info.

func NewParams

func NewParams(key []byte) (*Params, error)

NewParams creates new params to encrypt with provided key.

func (Params) Enabled

func (p Params) Enabled() bool

Enabled returns true if key isn't empty.

func (Params) HMAC

func (p Params) HMAC() ([]byte, []byte, error)

HMAC computes salted HMAC.

func (Params) Key

func (p Params) Key() []byte

Key returns encryption key.

func (Params) MatchObjectEncryption

func (p Params) MatchObjectEncryption(encInfo ObjectEncryption) error

MatchObjectEncryption checks if encryption params are valid for provided object.

type Range

type Range struct {
	Start uint64
	End   uint64
}

Range stores payload interval.

Jump to

Keyboard shortcuts

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