attachment

package
v0.9.30 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MPL-2.0 Imports: 8 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HashMismatch         = errors.New("mismatching SHA-256 digest")
	UnsupportedVersion   = errors.New("unsupported Matrix file encryption version")
	UnsupportedAlgorithm = errors.New("unsupported JWK encryption algorithm")
	InvalidKey           = errors.New("failed to decode key")
	InvalidInitVector    = errors.New("failed to decode initialization vector")
	ReaderClosed         = errors.New("encrypting reader was already closed")
)

Functions

This section is empty.

Types

type EncryptedFile

type EncryptedFile struct {
	Key        JSONWebKey          `json:"key"`
	InitVector string              `json:"iv"`
	Hashes     EncryptedFileHashes `json:"hashes"`
	Version    string              `json:"v"`
	// contains filtered or unexported fields
}

func NewEncryptedFile

func NewEncryptedFile() *EncryptedFile

func (*EncryptedFile) Decrypt

func (ef *EncryptedFile) Decrypt(ciphertext []byte) ([]byte, error)

func (*EncryptedFile) Encrypt

func (ef *EncryptedFile) Encrypt(plaintext []byte) []byte

func (*EncryptedFile) EncryptStream added in v0.7.5

func (ef *EncryptedFile) EncryptStream(reader io.Reader) io.ReadCloser

type EncryptedFileHashes

type EncryptedFileHashes struct {
	SHA256 string `json:"sha256"`
}

type JSONWebKey

type JSONWebKey struct {
	Key         string   `json:"k"`
	Algorithm   string   `json:"alg"`
	Extractable bool     `json:"ext"`
	KeyType     string   `json:"kty"`
	KeyOps      []string `json:"key_ops"`
}

Jump to

Keyboard shortcuts

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