Documentation ¶
Index ¶
- func IANARegisteredAlg(alg string) bool
- func IANARegisteredCrv(crv string) bool
- func IANARegisteredKeyops(keyops string) bool
- func IANARegisteredKty(kty string) bool
- func IANARegisteredUse(use string) bool
- type IJWK
- type JWK
- func (jwk *JWK) Equal(o *JWK) bool
- func (jwk *JWK) FromPrivateKey(key crypto.PrivateKey, X5C ...*x509.Certificate) error
- func (jwk *JWK) FromPublicKey(key crypto.PublicKey, X5C ...*x509.Certificate) error
- func (jwk *JWK) ToPrivateKey() (crypto.PrivateKey, error)
- func (jwk *JWK) ToPublicKey() (crypto.PublicKey, error)
- type OtherPrimes
- type Revoked
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IANARegisteredAlg ¶
IANARegisteredAlg is a set of "JSON Web Signature and Encryption Algorithms" from https://www.iana.org/assignments/jose/jose.xhtml as defined in https://www.rfc-editor.org/rfc/rfc7518#section-7.1
func IANARegisteredCrv ¶
IANARegisteredCrv is a set of "JSON Web Key Elliptic Curve" from https://www.iana.org/assignments/jose/jose.xhtml as mentioned in https://www.rfc-editor.org/rfc/rfc7518.html#section-6.2.1.1
func IANARegisteredKeyops ¶
IANARegisteredKeyops is a set of "JSON Web Key Operations" from https://www.iana.org/assignments/jose/jose.xhtml as mentioned in https://www.rfc-editor.org/rfc/rfc7517#section-4.3
func IANARegisteredKty ¶
IANARegisteredKty is a set of "JSON Web Key Types" from https://www.iana.org/assignments/jose/jose.xhtml as mentioned in https://www.rfc-editor.org/rfc/rfc7517#section-4.1
func IANARegisteredUse ¶
IANARegisteredUse is a set of "JSON Web Key Use" types from https://www.iana.org/assignments/jose/jose.xhtml as mentioned in https://www.rfc-editor.org/rfc/rfc7517#section-4.2
Types ¶
type IJWK ¶
type IJWK interface { ToPublicKey() (crypto.PublicKey, error) ToPrivateKey() (crypto.PublicKey, error) }
Interface for the JWK type
type JWK ¶
type JWK struct { KTY string `json:"kty,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.1 USE string `json:"use,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.2 KEYOPS []string `json:"key_ops,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.3 ALG string `json:"alg,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.4 and https://www.rfc-editor.org/rfc/rfc7518#section-4.1 KID string `json:"kid,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.5 X5U string `json:"x5u,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.6 X5C []string `json:"x5c,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.7 X5T string `json:"x5t,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.8 X5TS256 string `json:"x5t#S256,omitempty"` // https://www.rfc-editor.org/rfc/rfc7517#section-4.9 CRV string `json:"crv,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.2.1.1 and https://www.rfc-editor.org/rfc/rfc8037.html#section-2 X string `json:"x,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.2.1.2 and https://www.rfc-editor.org/rfc/rfc8037.html#section-2 Y string `json:"y,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.2.1.3 D string `json:"d,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.1 and https://www.rfc-editor.org/rfc/rfc7518#section-6.2.2.1 and https://www.rfc-editor.org/rfc/rfc8037.html#section-2 N string `json:"n,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.1.1 E string `json:"e,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.1.2 P string `json:"p,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.2 Q string `json:"q,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.3 DP string `json:"dp,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.4 DQ string `json:"dq,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.5 QI string `json:"qi,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.6 OTH []OtherPrimes `json:"oth,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.7 K string `json:"k,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.4.1 EXT bool `json:"ext,omitempty"` // https://www.w3.org/TR/WebCryptoAPI IAT types.NumericDate `json:"iat,omitempty"` // https://openid.net/specs/openid-federation-1_0.html#name-federation-historical-keys-res NBF string `json:"nbf,omitempty"` // https://openid.net/specs/openid-federation-1_0.html#name-federation-historical-keys-res EXP types.NumericDate `json:"exp,omitempty"` // https://openid.net/specs/openid-federation-1_0.html#name-federation-historical-keys-res Revoked Revoked `json:"revoked,omitempty"` // https://openid.net/specs/openid-federation-1_0.html#name-federation-historical-keys-res }
JWK is used to marshal or unmarshal a JSON Web Key. https://www.rfc-editor.org/rfc/rfc7517 https://www.rfc-editor.org/rfc/rfc7518 https://www.rfc-editor.org/rfc/rfc8037
You can find the full list at https://www.iana.org/assignments/jose/jose.xhtml under "JSON Web Key Parameters".
func (*JWK) FromPrivateKey ¶
func (jwk *JWK) FromPrivateKey(key crypto.PrivateKey, X5C ...*x509.Certificate) error
FromPrivateKey converts a crypto.PrivateKey and optional x509.Certificates to a JWK
func (*JWK) FromPublicKey ¶
ToPublicKey converts a crypto.PublicKey to a JWK
func (*JWK) ToPrivateKey ¶
func (jwk *JWK) ToPrivateKey() (crypto.PrivateKey, error)
ToPublicKey converts the JWK to a crypto.PrivateKey
type OtherPrimes ¶
type OtherPrimes struct { R string `json:"r,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.7.1 D string `json:"d,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.7.2 T string `json:"t,omitempty"` // https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.7.3 }
OtherPrimes is for RSA private keys that have more than 2 primes. https://www.rfc-editor.org/rfc/rfc7518#section-6.3.2.7
type Revoked ¶
type Revoked struct { RevokedAt types.NumericDate `json:"revoked_at,omitempty"` Reason string `json:"reason,omitempty"` }