jws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	// Should be "JWT" for JWT
	Type                     string                 `json:"typ,omitempty"`      // JWT 5.1, JWS 4.1.9, JWE 4.1.11
	ContentType              string                 `json:"cty,omitempty"`      // JWT 5.2, JWS 4.1.19, JWE 4.1.12
	Algorithm                string                 `json:"alg"`                // JWS 4.1.1, JWE 4.1.1
	EncryptionAlgorithm      string                 `json:"env,omitempty"`      // JWE 4.1.2
	CompressionAlgorithm     string                 `json:"zip,omitempty"`      // JWE 4.1.3, In Standard only DEF (DEFLATE RFC1951 is defined)
	JWKSetURL                string                 `json:"jku,omitempty"`      // JWS 4.1.2, JWE 4.1.4
	JSONWebKey               string                 `json:"jwk,omitempty"`      // JWS 4.1.3, JWE 4.1.5
	KeyID                    string                 `json:"kid,omitempty"`      // JWS 4.1.4, JWE 4.1.6
	X509URL                  string                 `json:"x5u,omitempty"`      // JWS 4.1.5, JWE 4.1.7
	X509CertChain            string                 `json:"x5c,omitempty"`      // JWS 4.1.6, JWE 4.1.8
	X509CertSha1Thumbprint   string                 `json:"x5t,omitempty"`      // JWS 4.1.7, JWE 4.1.9
	X509CertSha256Thumbprint string                 `json:"x5t#S256,omitempty"` // JWS 4.1.8, JWE 4.1.10
	Critical                 string                 `json:"crit,omitempty"`     // JWS 4.1.11, JWE 4.1.13
	AdditionalParams         map[string]interface{} `json:"-"`                  // JWT 5.3 Replicating Claims as Header Parameters, JWS 4.2 Public Header Parameter Names, JWS 4.3 Private Header Parameter Names
}

Header implements the RFC 7519 JSON Web Token JOSE Header JWT 5 Header implements the RFC 7515 JSON Web Signature JOSE Header: JWS 4 TODO (0x434d53) At the moment only the JWS Compact Serialization format (3.1) is supported

type JWSCompact

type JWSCompact struct {
	Header  *Header
	Payload string
}

func Decode

func Decode(message string) (*JWSCompact, error)

Decode just decodes the JWS and does NOT Verify it. This might be useful if you want to check something in the JWS before Verifying PLEASE NOT THAT NONE OF THE INFORMATION CAN BE TRUSTED IF YOU DON'T CHECK THE SIGNATURE

func DecodeAndVerify

func DecodeAndVerify(message string, sv jwa.SignerVerifier) (*JWSCompact, error)

DecodeAndVerify decodes and verifies the given JWS message using the given SignerVerifier

func (*JWSCompact) EncodeAndSignCompact

func (j *JWSCompact) EncodeAndSignCompact(sv jwa.SignerVerifier) (string, error)

EncodeAndSignCompact encodes and signs a JWS message in Compact Serialization form. The payload HAS to be in base64 encoding

type JWSJSON

type JWSJSON struct {
	Header     string
	Payload    string `json:"payload"` // Has to be base64 encoded
	Protected  string
	Signatures map[string]string `json:"signatures"`
}

func (*JWSJSON) EncodeAndSignJSON

func (j *JWSJSON) EncodeAndSignJSON(sv jwa.SignerVerifier) (string, error)

EncodeAndSignJSON encodes and signs a JWS message in general JSON Serialization Syntax

type JWSJSONFlat

type JWSJSONFlat struct {
	Header     string
	Protected  string `json:"protected"`
	Signatured string `json:"signature"`
	Payload    string `json:"payload"`
}

Jump to

Keyboard shortcuts

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