jwe

package
v0.0.0-...-42652ab Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A128CBC_HS256 = "A128CBC-HS256"
	A256GCM       = "A256GCM"
	A128GCM       = "A128GCM"
	A192GCM       = "A192GCM"
)

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(config JWEConfig, payload string, header JOSEHeader) (string, error)

Types

type JOSEHeader

type JOSEHeader struct {
	Alg string `json:"alg"`
	Enc string `json:"enc"`
	Kid string `json:"kid"`
	Cty string `json:"cty"`
}

func ParseJOSEHeader

func ParseJOSEHeader(encodedHeader string) (*JOSEHeader, error)

func (JOSEHeader) ToJson

func (header JOSEHeader) ToJson() ([]byte, error)

type JWEConfig

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

func (*JWEConfig) GetCek

func (config *JWEConfig) GetCek() []byte

func (*JWEConfig) GetCertificate

func (config *JWEConfig) GetCertificate() *x509.Certificate

func (*JWEConfig) GetDecryptionKey

func (config *JWEConfig) GetDecryptionKey() *rsa.PrivateKey

func (*JWEConfig) GetDecryptionPaths

func (config *JWEConfig) GetDecryptionPaths() map[string]string

func (*JWEConfig) GetEncryptedValueFieldName

func (config *JWEConfig) GetEncryptedValueFieldName() string

func (*JWEConfig) GetEncryptionKey

func (config *JWEConfig) GetEncryptionKey() *rsa.PublicKey

func (*JWEConfig) GetEncryptionKeyFingerprint

func (config *JWEConfig) GetEncryptionKeyFingerprint() string

func (*JWEConfig) GetEncryptionPaths

func (config *JWEConfig) GetEncryptionPaths() map[string]string

func (*JWEConfig) GetIv

func (config *JWEConfig) GetIv() []byte

type JWEConfigBuilder

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

func NewJWEConfigBuilder

func NewJWEConfigBuilder() *JWEConfigBuilder

func (*JWEConfigBuilder) Build

func (cb *JWEConfigBuilder) Build() *JWEConfig

func (*JWEConfigBuilder) WithCek

func (cb *JWEConfigBuilder) WithCek(cek []byte) *JWEConfigBuilder

func (*JWEConfigBuilder) WithCertificate

func (cb *JWEConfigBuilder) WithCertificate(certificate *x509.Certificate) *JWEConfigBuilder

func (*JWEConfigBuilder) WithDecryptionKey

func (cb *JWEConfigBuilder) WithDecryptionKey(decryptionKey *rsa.PrivateKey) *JWEConfigBuilder

func (*JWEConfigBuilder) WithDecryptionPath

func (cb *JWEConfigBuilder) WithDecryptionPath(jsonPathIn, jsonPathOut string) *JWEConfigBuilder

func (*JWEConfigBuilder) WithEncryptedValueFieldName

func (cb *JWEConfigBuilder) WithEncryptedValueFieldName(encryptedValueFieldName string) *JWEConfigBuilder

func (*JWEConfigBuilder) WithEncryptionKey

func (cb *JWEConfigBuilder) WithEncryptionKey(encryptionKey *rsa.PublicKey) *JWEConfigBuilder

func (*JWEConfigBuilder) WithEncryptionPath

func (cb *JWEConfigBuilder) WithEncryptionPath(jsonPathIn, jsonPathOut string) *JWEConfigBuilder

func (*JWEConfigBuilder) WithIv

func (cb *JWEConfigBuilder) WithIv(iv []byte) *JWEConfigBuilder

type JWEObject

type JWEObject struct {
	JoseHeader   *JOSEHeader
	Aad          string
	EncryptedKey string
	Iv           string
	CipherText   string
	AuthTag      string
}

func ParseJWEObject

func ParseJWEObject(encryptedPayload string) (*JWEObject, error)

func (JWEObject) Decrypt

func (jweObject JWEObject) Decrypt(config JWEConfig) (string, error)

func (JWEObject) Serialize

func (jweObject JWEObject) Serialize() string

Jump to

Keyboard shortcuts

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