httpece

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 12 Imported by: 8

README

http-ece

GoDoc Go Report Card MIT License

a simple implementation of HTTP Encrypted Content-Encoding scheme(RFC 8188) for Go.

Requirements

Go 1.23 and beyond.

Install

go get -u github.com/crow-misia/http-ece

Build

go generate
go build

Reference

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyIDTooLong          = errors.New("keyID too long")
	ErrTruncated             = errors.New("content truncated")
	ErrInvalidPaddingLast    = errors.New("last block must start padding with 0x02")
	ErrInvalidPaddingNonLast = errors.New("non-last block must start padding with 0x01")
	ErrAllZeroPlaintext      = errors.New("all zero plaintext")
	ErrUnableDetermineKey    = errors.New("unable to determine key")
	ErrNoAuthSecret          = errors.New("no authentication secret for webpush")
)

Functions

func Decrypt

func Decrypt(content []byte, opts ...Option) ([]byte, error)

Decrypt decrypts content data.

func Encrypt

func Encrypt(plaintext []byte, opts ...Option) ([]byte, error)

Encrypt encrypts plaintext data.

Types

type ContentEncoding

type ContentEncoding string

ContentEncoding is crypto data encoding

const (
	AES128GCM ContentEncoding = "aes128gcm"
	AESGCM    ContentEncoding = "aesgcm"
)

func (ContentEncoding) Padding

func (i ContentEncoding) Padding() uint32

Padding returns crypto data padding size.

type KeyMappingFn added in v0.1.0

type KeyMappingFn func([]byte) []byte

type Option

type Option func(*options) error

func WithAuthSecret

func WithAuthSecret(v []byte) Option

func WithDh

func WithDh(v []byte) Option

func WithEncoding

func WithEncoding(v ContentEncoding) Option

func WithKey added in v0.1.0

func WithKey(v []byte) Option

func WithKeyID added in v0.2.0

func WithKeyID(v []byte) Option

func WithKeyLabel

func WithKeyLabel(v []byte) Option

func WithKeyMap

func WithKeyMap(v KeyMappingFn) Option

func WithPad added in v0.1.1

func WithPad(v uint32) Option

func WithPrivate

func WithPrivate(v []byte) Option

func WithRecordSize

func WithRecordSize(v uint32) Option

func WithSalt

func WithSalt(v []byte) Option

Jump to

Keyboard shortcuts

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