jose

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//AlgRS256 RSA PKCS #1 and SHA-2 256
	AlgRS256 Alg = "RS256"
	//AlgRS384 RSA PKCS #1 and SHA-2 384
	AlgRS384 Alg = "RS384"
	//AlgRS512 RSA PKCS #1 and SHA-2 512
	AlgRS512 Alg = "RS512"
	//AlgPS256 RSA PSS signature with SHA-2 256
	AlgPS256 Alg = "PS256"
	//AlgPS384 RSA PSS signature with SHA-2 384
	AlgPS384 Alg = "PS384"
	//AlgPS512 RSA PSS signature with SHA-2 512
	AlgPS512 Alg = "PS512"
	//AlgES256 EC DSA signature with SHA-2 256
	AlgES256 Alg = "ES256"
	//AlgES384 EC DSA signature with SHA-2 384
	AlgES384 Alg = "ES384"
	//AlgES512 EC DSA signature with SHA-2 512
	AlgES512 Alg = "ES512"
	//AlgA128GCM AES GCM using 128-bit key
	AlgA128GCM Alg = "A128GCM"
	//AlgA192GCM AES GCM using 192-bit key
	AlgA192GCM Alg = "A192GCM"
	//AlgA256GCM AES GCM using 256-bit key
	AlgA256GCM Alg = "A256GCM"
	//AlgA256CBC AES CBC using 256-bit key
	AlgA256CBC Alg = "A256CBC"
	// AlgDir direct encryption for use with JWEs
	AlgDir Alg = "dir"
	// AlgRSAOAEP RSA OAEP Key encryption for use with JWEs
	AlgRSAOAEP = "RSA-OAEP"

	//CrvP256 NIST P-256
	CrvP256 Crv = "P-256"
	//CrvP384 NIST P-384
	CrvP384 Crv = "P-384"
	//CrvP521 NIST P-521
	CrvP521 Crv = "P-521"

	//KtyRSA RSA key type
	KtyRSA Kty = "RSA"
	//KtyEC Elliptical Curve key type
	KtyEC Kty = "EC"
	//KtyOct Octet key type
	KtyOct Kty = "oct"

	//KeyUseEnc encryption usage
	KeyUseEnc KeyUse = "enc"
	//KeyUseSig signing usage
	KeyUseSig KeyUse = "sig"

	//KeyOpsSign sign stuff
	KeyOpsSign KeyOps = "sign"
	//KeyOpsVerify verify signed stuff
	KeyOpsVerify KeyOps = "verify"
	//KeyOpsEncrypt encrypt stuff
	KeyOpsEncrypt KeyOps = "encrypt"
	//KeyOpsDecrypt decrypt stuff
	KeyOpsDecrypt KeyOps = "decrypt"
	//KeyOpsWrapKey wrap keys
	KeyOpsWrapKey KeyOps = "wrapKey"
	//KeyOpsUnwrapKey unwrap keys
	KeyOpsUnwrapKey KeyOps = "unwrapKey"
	//KeyOpsDeriveKey derive a key
	KeyOpsDeriveKey KeyOps = "deriveKey"
	//KeyOpsDeriveBits derive bits
	KeyOpsDeriveBits KeyOps = "deriveBits"

	//JwtType JWT type
	JwtType JwsType = "JWT"

	// EncA128GCM AES GCM 128 Enc type
	EncA128GCM Enc = "A128GCM"
	// EncA192GCM AES GCM 192 Enc type
	EncA192GCM Enc = "A192GCM"
	// EncA256GCM AES GCM 256 Enc type
	EncA256GCM Enc = "A256GCM"
	// EncA256CBC AES CBC 256 Enc type
	EncA256CBC Enc = "A256CBC"

	// DeflateZip deflate type
	DeflateZip Zip = "DEF"
)

Variables

View Source
var (
	//ErrJSONFormat when bad JSON string provided
	ErrJSONFormat = errors.New("invalid JSON format")
	//ErrBlobEmpty when bad Blob provided
	ErrBlobEmpty = errors.New("invalid Blob format, may not be empty")
	//ErrUnsupportedKeyType when a key type is unknown/unsupported
	ErrUnsupportedKeyType = errors.New("unsupported key type")
	//ErrUnexpectedKeyType when a key shows up in the wrong place.
	ErrUnexpectedKeyType = errors.New("unexpected key type")
	//ErrJwtFormat when a JWT isn't formatted correctly
	ErrJwtFormat = errors.New("invalid JWT format")
	//ErrDuplicateKeyOps too many of the same operation requested
	ErrDuplicateKeyOps = errors.New("duplicate key_ops entries")
	//ErrJwkInconsistentCertificateFields when a certificates fields are not what was expected
	ErrJwkInconsistentCertificateFields = errors.New("inconsistent certificate fields")
	//ErrJwkInvalidFingerprintfomat the fingerprint field (x5t) is encoded in an incorrect format
	ErrJwkInvalidFingerprintfomat = errors.New("invalid fingerprint format")

	//ErrJwkReservedClaimName invalid use of a reserved/defined claim name
	ErrJwkReservedClaimName = errors.New("incorrect use of reserved claim name")

	//ErrJweFormat when a JWE isn't formatted correctly
	ErrJweFormat = errors.New("invalid JWE format")
)

Functions

func MarshalJws

func MarshalJws(body string, signature []byte) string

MarshalJws body and signature to a string

Types

type Alg

type Alg string

Alg is a type for representing values destined for `alg` fields in JWK and JWTs.

type Audiences

type Audiences struct {
	Aud []string
}

Audiences holds audience members

func (*Audiences) MarshalJSON

func (audiences *Audiences) MarshalJSON() (dst []byte, err error)

MarshalJSON audience to byte slice or error

func (*Audiences) UnmarshalJSON

func (audiences *Audiences) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice to audience members or error

type AutomaticJwtClaims

type AutomaticJwtClaims struct {
	Issuer   string `json:"iss,omitempty"`
	IssuedAt int64  `json:"iat,omitempty"`
	JwtID    string `json:"jti,omitempty"`
}

AutomaticJwtClaims represent standard JWT claims that should not generally be set by a caller. For example the iat (issued-at) claim should only be set by a signer not the caller who requests the JWT.

type BigNum

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

BigNum for managing big.Int

func (*BigNum) Empty

func (b *BigNum) Empty() bool

Empty out BigNum

func (*BigNum) Int

func (b *BigNum) Int() *big.Int

Int as big.Int

func (*BigNum) MarshalJSON

func (b *BigNum) MarshalJSON() (dst []byte, err error)

MarshalJSON as byte slice or error

func (*BigNum) Set

func (b *BigNum) Set(val *big.Int) *BigNum

Set bigNum with bit.Int

func (*BigNum) SetBytes

func (b *BigNum) SetBytes(val []byte) *BigNum

SetBytes of BigNum

func (*BigNum) UnmarshalJSON

func (b *BigNum) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice or error

type Blob

type Blob struct {
	B []byte
}

Blob represents a url-safe base64 encoded byte block.

func (*Blob) Bytes

func (b *Blob) Bytes() []byte

Bytes of blob in byte slice

func (*Blob) MarshalJSON

func (b *Blob) MarshalJSON() (dst []byte, err error)

MarshalJSON blob to byte slice

func (*Blob) SetBytes

func (b *Blob) SetBytes(val []byte) *Blob

SetBytes of blob

func (*Blob) UnmarshalJSON

func (b *Blob) UnmarshalJSON(src []byte) error

UnmarshalJSON byte slice to Blob, or error

type Certificate

type Certificate struct {
	Certificate *x509.Certificate
}

Certificate leaf for JWK

func (*Certificate) MarshalJSON

func (c *Certificate) MarshalJSON() (dst []byte, err error)

MarshalJSON as byte slice or error

func (*Certificate) UnmarshalJSON

func (c *Certificate) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice to certificate, or error

type Crv

type Crv string

Crv is a type for representing values destined for `crv` fields in JWKs.

type Enc

type Enc string

Enc is a type representing values destined for the `enc` field in a JWE header.

type Fingerprint

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

Fingerprint represents a SHA1 digest

func (*Fingerprint) Bytes

func (f *Fingerprint) Bytes() []byte

Bytes of blob in byte slice

func (*Fingerprint) MarshalJSON

func (f *Fingerprint) MarshalJSON() (dst []byte, err error)

MarshalJSON Fingerprint to byte slice

func (*Fingerprint) SetBytes

func (f *Fingerprint) SetBytes(val []byte) *Fingerprint

SetBytes of Fingerprint

func (*Fingerprint) UnmarshalJSON

func (f *Fingerprint) UnmarshalJSON(src []byte) error

UnmarshalJSON byte slice to Fingerprint, or error

type Header struct {
	Alg Alg    `json:"alg"`
	Jku string `json:"jku,omitempty"`
	//jwkFields []jwkFields `json:"jwk,omitempty"`  TODO finish this
	Kid    string   `json:"kid,omitempty"`
	X5U    string   `json:"x5u,omitempty"`
	X5C    [][]byte `json:"x5c,omitempty"`
	X5T    *Blob    `json:"x5t,omitempty"`
	X5T256 *Blob    `json:"x5t#S256,omitempty"`
	Typ    JwsType  `json:"typ,omitempty"`
	Cty    JwsType  `json:"cty,omitempty"`
}

type HeaderRfc7516

HeaderRfc7516 For a JWE, the JOSE Header members are the union of the members of :

o  JWE Protected Header
o  JWE Shared Unprotected Header
o  JWE Per-Recipient Unprotected Header

func (*HeaderRfc7516) MarshallHeader

func (jweHeader *HeaderRfc7516) MarshallHeader() (marshalledHeader []byte, err error)

type Jwe

type Jwe struct {
	Header           JweHeader
	MarshalledHeader []byte
	EncryptedKey     []byte
	Iv               []byte
	Ciphertext       []byte
	Tag              []byte
	Plaintext        []byte
}

Jwe representation of a JWE. Beware : this Jwe implementation does not respect rfc 7516. Use JweRfc7516 instead. DEPRECATED

func (*Jwe) Marshal

func (jwe *Jwe) Marshal() string

Marshal a JWE to it's compact representation.

func (*Jwe) MarshalHeader

func (jwe *Jwe) MarshalHeader() (err error)

MarshalHeader marshal JWE header. Note this is not guaranteed to result in the same marshaled representation across invocations.

func (*Jwe) Unmarshal

func (jwe *Jwe) Unmarshal(src string) (err error)

Unmarshal to body string, or error DEPRECATED : does not match the proper JWE structure as defined in rfc 7516

type JweCustomHeaderFields

type JweCustomHeaderFields struct {
	// Other AAD for transporting AAD around with the JWE...
	OtherAad *Blob `json:"_thales_aad,omitempty"`
}

JweCustomHeaderFields custom JWE defined fields.

type JweHeader

type JweHeader struct {
	JwsHeader
	JweCustomHeaderFields
	Enc Enc `json:"enc"`
	Zip Zip `json:"zip,omitempty"`
}

JweHeader JWE header fields. DEPRECATED

func (*JweHeader) MarshalHeader

func (jweHeader *JweHeader) MarshalHeader() (marshalledHeader []byte, err error)

type JwePerRecipientUnprotectedHeader

type JwePerRecipientUnprotectedHeader struct {
	PlaintextLength int `json:"plaintextLength"`
}

JwePerRecipientUnprotectedHeader

JSON object that contains Header Parameters that apply to a single
recipient of the JWE.  These Header Parameter values are not
integrity protected.  This can only be present when using the JWE
JSON Serialization.

type JweProtectedHeader

type JweProtectedHeader struct {
	JwsHeader
	JweCustomHeaderFields
	Enc Enc `json:"enc"`
	Zip Zip `json:"zip,omitempty"`
}

JweProtectedHeader

JSON object that contains the Header Parameters that are integrity
protected by the authenticated encryption operation.  These
parameters apply to all recipients of the JWE.  For the JWE
Compact Serialization, this comprises the entire JOSE Header.  For
the JWE JSON Serialization, this is one component of the JOSE
Header.

func (*JweProtectedHeader) MarshalProtectedHeader

func (jweProtectedHeader *JweProtectedHeader) MarshalProtectedHeader() (marshalledHeader []byte, err error)

type JweRfc7516

type JweRfc7516 struct {
	Header               HeaderRfc7516
	EncryptedKey         []byte
	InitializationVector []byte
	Ciphertext           []byte
	AuthenticationTag    []byte
	AAD                  []byte
}

type JweRfc7516Compact

type JweRfc7516Compact struct {
	ProtectedHeader      JweProtectedHeader
	EncryptedKey         []byte
	InitializationVector []byte
	Ciphertext           []byte
	AuthenticationTag    []byte
}

func (*JweRfc7516Compact) Marshal

func (jwe *JweRfc7516Compact) Marshal() (marshalledJwe string, err error)

Marshal a JWE to it's compact representation.

func (*JweRfc7516Compact) Unmarshal

func (jwe *JweRfc7516Compact) Unmarshal(src string) (err error)

type JweSharedUnprotectedHeader

type JweSharedUnprotectedHeader struct{}

JweSharedUnprotectedHeader

JSON object that contains the Header Parameters that apply to all
recipients of the JWE that are not integrity protected.  This can
only be present when using the JWE JSON Serialization.

type Jwk

type Jwk interface {
	Kty() Kty
	Use() KeyUse
	SetUse(use KeyUse)
	Ops() []KeyOps
	SetOps(ops []KeyOps)
	Alg() Alg
	SetAlg(alg Alg)
	Kid() string
	SetKid(kid string)
	X5C() []*x509.Certificate
	SetX5C(x5c []*x509.Certificate)
	X5T() *Fingerprint
	SetX5T(hash *Fingerprint)
	// TODO: Add x5t#S256 handling including consistency checking
	// CheckConsistency verify the JWK is well formed.
	CheckConsistency() error
}

Jwk provides an interface for setting and getting common fields irrespective of key type.

func UnmarshalJwk

func UnmarshalJwk(reader io.ReadSeeker) (jwk Jwk, err error)

UnmarshalJwk serialization into a concrete type.

type Jwks

type Jwks struct {
	Keys []Jwk `json:"keys"`
}

Jwks key store

func (*Jwks) UnmarshalJSON

func (j *Jwks) UnmarshalJSON(data []byte) error

UnmarshalJSON byte slice into key store, or error

type Jws

type Jws struct {
	Header    *JwsHeader
	Payload   interface{}
	Signature []byte
}

Jws jave web signature

func (*Jws) Body

func (jws *Jws) Body() (body string, err error)

Body return either the original JWS payload or alternatively one generated.

func (*Jws) MarshalBody

func (jws *Jws) MarshalBody() (body string, err error)

MarshalBody marshaled representation of the JWT Header and Claims.

func (*Jws) Unmarshal

func (jws *Jws) Unmarshal(src string) (body string, err error)

Unmarshal to body string, or error

type JwsHeader

type JwsHeader struct {
	Alg Alg    `json:"alg"`
	Jku string `json:"jku,omitempty"`
	//jwkFields []jwkFields `json:"jwk,omitempty"`  TODO finish this
	Kid    string   `json:"kid,omitempty"`
	X5U    string   `json:"x5u,omitempty"`
	X5C    [][]byte `json:"x5c,omitempty"`
	X5T    *Blob    `json:"x5t,omitempty"`
	X5T256 *Blob    `json:"x5t#S256,omitempty"`
	Typ    JwsType  `json:"typ,omitempty"`
	Cty    JwsType  `json:"cty,omitempty"`
	Crit   []string `json:"crit,omitempty"`
}

JwsHeader header for JWS

type JwsType

type JwsType string

JwsType is a type for representing values destined for `typ` fields in JWS and JWTs.

type Jwt

type Jwt struct {
	Header    JwsHeader
	Claims    JwtClaims
	Signature []byte
}

Jwt defines a Jave web token

func (*Jwt) MarshalBody

func (jwt *Jwt) MarshalBody() (body string, err error)

MarshalBody representation of the JWT Header and Claims.

func (*Jwt) Unmarshal

func (jwt *Jwt) Unmarshal(src string) (body string, err error)

Unmarshal string to JWT body, or error

func (*Jwt) Verify

func (jwt *Jwt) Verify() error

Verify JWT is valid or error

type JwtClaims

JwtClaims claims for a JWT

func (*JwtClaims) MarshalJSON

func (c *JwtClaims) MarshalJSON() (dst []byte, err error)

MarshalJSON implements json.Marshaler interface method.

func (*JwtClaims) UnmarshalCustomClaim

func (c *JwtClaims) UnmarshalCustomClaim(name string, claim interface{}) error

UnmarshalCustomClaim Unmarshals a custom claim. A Claim that do not exist is unset but no error is returned.

func (*JwtClaims) UnmarshalJSON

func (c *JwtClaims) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements json.Unmarshaler interface method.

type KeyOps

type KeyOps string

KeyOps is a type for representing values destined for `key_ops` fields in JWKs.

type KeyUse

type KeyUse string

KeyUse is a type for representing values destined for `use` fields in JWKs.

type Kty

type Kty string

Kty is a type for representing values destined for `kty` fields in JWKs.

type OctSecretKey

type OctSecretKey struct {
	OctSecretKeyFields
	// contains filtered or unexported fields
}

OctSecretKey Secret key JWK type.

func (*OctSecretKey) Alg

func (j *OctSecretKey) Alg() Alg

func (*OctSecretKey) CheckConsistency

func (j *OctSecretKey) CheckConsistency() error

func (*OctSecretKey) Kid

func (j *OctSecretKey) Kid() string

func (*OctSecretKey) Kty

func (k *OctSecretKey) Kty() Kty

Kty key type

func (*OctSecretKey) MarshalJSON

func (k *OctSecretKey) MarshalJSON() (dst []byte, err error)

MarshalJSON to byte slice or error

func (*OctSecretKey) Ops

func (j *OctSecretKey) Ops() []KeyOps

func (*OctSecretKey) SetAlg

func (j *OctSecretKey) SetAlg(alg Alg)

func (*OctSecretKey) SetKid

func (j *OctSecretKey) SetKid(kid string)

func (*OctSecretKey) SetOps

func (j *OctSecretKey) SetOps(ops []KeyOps)

func (*OctSecretKey) SetUse

func (j *OctSecretKey) SetUse(use KeyUse)

func (*OctSecretKey) SetX5C

func (j *OctSecretKey) SetX5C(x5c []*x509.Certificate)

func (*OctSecretKey) SetX5T

func (j *OctSecretKey) SetX5T(blob *Fingerprint)

func (*OctSecretKey) UnmarshalJSON

func (k *OctSecretKey) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON to to byte slice or error

func (*OctSecretKey) Use

func (j *OctSecretKey) Use() KeyUse

func (*OctSecretKey) X5C

func (j *OctSecretKey) X5C() []*x509.Certificate

func (*OctSecretKey) X5T

func (j *OctSecretKey) X5T() *Fingerprint

type OctSecretKeyFields

type OctSecretKeyFields struct {
	K Blob `json:"k"`
}

OctSecretKeyFields Secret key specific fields.

type PrivateEcKey

type PrivateEcKey struct {
	PublicEcKey
	PrivateEcKeyFields
}

PrivateEcKey Private EC JWK type.

func (*PrivateEcKey) Alg

func (j *PrivateEcKey) Alg() Alg

func (*PrivateEcKey) CheckConsistency

func (j *PrivateEcKey) CheckConsistency() error

func (*PrivateEcKey) Kid

func (j *PrivateEcKey) Kid() string

func (*PrivateEcKey) Kty

func (k *PrivateEcKey) Kty() Kty

Kty key type

func (*PrivateEcKey) MarshalJSON

func (k *PrivateEcKey) MarshalJSON() (dst []byte, err error)

MarshalJSON to byte slice or error

func (*PrivateEcKey) Ops

func (j *PrivateEcKey) Ops() []KeyOps

func (*PrivateEcKey) SetAlg

func (j *PrivateEcKey) SetAlg(alg Alg)

func (*PrivateEcKey) SetKid

func (j *PrivateEcKey) SetKid(kid string)

func (*PrivateEcKey) SetOps

func (j *PrivateEcKey) SetOps(ops []KeyOps)

func (*PrivateEcKey) SetUse

func (j *PrivateEcKey) SetUse(use KeyUse)

func (*PrivateEcKey) SetX5C

func (j *PrivateEcKey) SetX5C(x5c []*x509.Certificate)

func (*PrivateEcKey) SetX5T

func (j *PrivateEcKey) SetX5T(blob *Fingerprint)

func (*PrivateEcKey) UnmarshalJSON

func (k *PrivateEcKey) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice or error

func (*PrivateEcKey) Use

func (j *PrivateEcKey) Use() KeyUse

func (*PrivateEcKey) X5C

func (j *PrivateEcKey) X5C() []*x509.Certificate

func (*PrivateEcKey) X5T

func (j *PrivateEcKey) X5T() *Fingerprint

type PrivateEcKeyFields

type PrivateEcKeyFields struct {
	D BigNum `json:"d"`
}

PrivateEcKeyFields Private EC specific fields.

type PrivateRsaKey

type PrivateRsaKey struct {
	PublicRsaKey
	PrivateRsaKeyFields
}

PrivateRsaKey Private RSA JWK type.

func (*PrivateRsaKey) Alg

func (j *PrivateRsaKey) Alg() Alg

func (*PrivateRsaKey) CheckConsistency

func (j *PrivateRsaKey) CheckConsistency() error

func (*PrivateRsaKey) Kid

func (j *PrivateRsaKey) Kid() string

func (*PrivateRsaKey) Kty

func (k *PrivateRsaKey) Kty() Kty

Kty key type

func (*PrivateRsaKey) MarshalJSON

func (k *PrivateRsaKey) MarshalJSON() (dst []byte, err error)

MarshalJSON to byte slice or error

func (*PrivateRsaKey) Ops

func (j *PrivateRsaKey) Ops() []KeyOps

func (*PrivateRsaKey) SetAlg

func (j *PrivateRsaKey) SetAlg(alg Alg)

func (*PrivateRsaKey) SetKid

func (j *PrivateRsaKey) SetKid(kid string)

func (*PrivateRsaKey) SetOps

func (j *PrivateRsaKey) SetOps(ops []KeyOps)

func (*PrivateRsaKey) SetUse

func (j *PrivateRsaKey) SetUse(use KeyUse)

func (*PrivateRsaKey) SetX5C

func (j *PrivateRsaKey) SetX5C(x5c []*x509.Certificate)

func (*PrivateRsaKey) SetX5T

func (j *PrivateRsaKey) SetX5T(blob *Fingerprint)

func (*PrivateRsaKey) UnmarshalJSON

func (k *PrivateRsaKey) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice or error

func (*PrivateRsaKey) Use

func (j *PrivateRsaKey) Use() KeyUse

func (*PrivateRsaKey) X5C

func (j *PrivateRsaKey) X5C() []*x509.Certificate

func (*PrivateRsaKey) X5T

func (j *PrivateRsaKey) X5T() *Fingerprint

type PrivateRsaKeyFields

type PrivateRsaKeyFields struct {
	D  BigNum `json:"d"`
	P  BigNum `json:"p"`
	Q  BigNum `json:"q"`
	Dp BigNum `json:"dp"`
	Dq BigNum `json:"dq"`
	Qi BigNum `json:"qi"`
}

PrivateRsaKeyFields Private RSA specific fields.

type PublicEcKey

type PublicEcKey struct {
	PublicEcKeyFields
	// contains filtered or unexported fields
}

PublicEcKey Public EC JWK type.

func (*PublicEcKey) Alg

func (j *PublicEcKey) Alg() Alg

func (*PublicEcKey) CheckConsistency

func (j *PublicEcKey) CheckConsistency() error

func (*PublicEcKey) Kid

func (j *PublicEcKey) Kid() string

func (*PublicEcKey) Kty

func (k *PublicEcKey) Kty() Kty

Kty key type

func (*PublicEcKey) MarshalJSON

func (k *PublicEcKey) MarshalJSON() (dst []byte, err error)

MarshalJSON to byte slice or error

func (*PublicEcKey) Ops

func (j *PublicEcKey) Ops() []KeyOps

func (*PublicEcKey) SetAlg

func (j *PublicEcKey) SetAlg(alg Alg)

func (*PublicEcKey) SetKid

func (j *PublicEcKey) SetKid(kid string)

func (*PublicEcKey) SetOps

func (j *PublicEcKey) SetOps(ops []KeyOps)

func (*PublicEcKey) SetUse

func (j *PublicEcKey) SetUse(use KeyUse)

func (*PublicEcKey) SetX5C

func (j *PublicEcKey) SetX5C(x5c []*x509.Certificate)

func (*PublicEcKey) SetX5T

func (j *PublicEcKey) SetX5T(blob *Fingerprint)

func (*PublicEcKey) UnmarshalJSON

func (k *PublicEcKey) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice or error

func (*PublicEcKey) Use

func (j *PublicEcKey) Use() KeyUse

func (*PublicEcKey) X5C

func (j *PublicEcKey) X5C() []*x509.Certificate

func (*PublicEcKey) X5T

func (j *PublicEcKey) X5T() *Fingerprint

type PublicEcKeyFields

type PublicEcKeyFields struct {
	Crv Crv    `json:"crv"`
	X   BigNum `json:"x"`
	Y   BigNum `json:"y"`
}

PublicEcKeyFields Public EC specific fields.

type PublicRsaKey

type PublicRsaKey struct {
	PublicRsaKeyFields
	// contains filtered or unexported fields
}

PublicRsaKey Public RSA JWK type.

func (*PublicRsaKey) Alg

func (j *PublicRsaKey) Alg() Alg

func (*PublicRsaKey) CheckConsistency

func (j *PublicRsaKey) CheckConsistency() error

func (*PublicRsaKey) Kid

func (j *PublicRsaKey) Kid() string

func (*PublicRsaKey) Kty

func (k *PublicRsaKey) Kty() Kty

Kty key type

func (*PublicRsaKey) MarshalJSON

func (k *PublicRsaKey) MarshalJSON() (dst []byte, err error)

MarshalJSON to byte slice or error

func (*PublicRsaKey) Ops

func (j *PublicRsaKey) Ops() []KeyOps

func (*PublicRsaKey) SetAlg

func (j *PublicRsaKey) SetAlg(alg Alg)

func (*PublicRsaKey) SetKid

func (j *PublicRsaKey) SetKid(kid string)

func (*PublicRsaKey) SetOps

func (j *PublicRsaKey) SetOps(ops []KeyOps)

func (*PublicRsaKey) SetUse

func (j *PublicRsaKey) SetUse(use KeyUse)

func (*PublicRsaKey) SetX5C

func (j *PublicRsaKey) SetX5C(x5c []*x509.Certificate)

func (*PublicRsaKey) SetX5T

func (j *PublicRsaKey) SetX5T(blob *Fingerprint)

func (*PublicRsaKey) UnmarshalJSON

func (k *PublicRsaKey) UnmarshalJSON(src []byte) (err error)

UnmarshalJSON byte slice or error

func (*PublicRsaKey) Use

func (j *PublicRsaKey) Use() KeyUse

func (*PublicRsaKey) X5C

func (j *PublicRsaKey) X5C() []*x509.Certificate

func (*PublicRsaKey) X5T

func (j *PublicRsaKey) X5T() *Fingerprint

type PublicRsaKeyFields

type PublicRsaKeyFields struct {
	N BigNum `json:"n"`
	E BigNum `json:"e"`
}

PublicRsaKeyFields Public RSA specific fields.

type SettableJwtClaims

type SettableJwtClaims struct {
	Subject    string    `json:"sub,omitempty"`
	Audiences  Audiences `json:"aud,omitempty"`
	Expiration int64     `json:"exp,omitempty"`
	NotBefore  int64     `json:"nbf,omitempty"`
}

SettableJwtClaims are claims generally requested by a caller and not a signer.

type UntypedClaims

type UntypedClaims map[string]json.RawMessage

UntypedClaims for non-standard clains

type Zip

type Zip string

Zip is a type representing values destined for the `zip` field in a JWE header.

Jump to

Keyboard shortcuts

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