jwe

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Alg string `json:"alg"`
	Enc string `json:"enc"`
	KID string `json:"kid"`
}

type JWE

type JWE struct {
	Ciphertext, IV, Tag []byte
	Header              Header
}

JWE implements a subset of JSON Web Encryption (https://datatracker.ietf.org/doc/html/rfc7516). It supports only direct encryption (https://datatracker.ietf.org/doc/html/rfc7518#section-4.5) with A128CBC-HS256 and de/serializes only the compact format.

func Encrypt

func Encrypt(plaintext []byte, kid string, alg *aescbc.AESCBCHMACSHA2) (JWE, error)

func ParseCompactFormat

func ParseCompactFormat(b []byte) (JWE, error)

ParseCompactFormat deserializes the compact format as returned by JWE.Serialize

func (*JWE) Decrypt

func (j *JWE) Decrypt(key []byte) ([]byte, error)

func (*JWE) Serialize

func (j *JWE) Serialize() (string, error)

Serialize the JWE to compact format

Jump to

Keyboard shortcuts

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