Versions in this module Expand all Collapse all v0 v0.7.0-pre.2 Nov 25, 2020 v0.7.0-pre.1 Oct 21, 2020 v0.6.5 Oct 21, 2020 v0.6.4 Oct 2, 2020 v0.6.3 Oct 2, 2020 Changes in this version + func Verify(pubkey PublicKey, hash []byte, sig []byte) bool + func VerifyClaims(pubkey PublicKey, jws *JWS) (errs []error) + type ECJWK struct + Curve string + KeyID string + Seed string + Use []string + X string + Y string + type JWK interface type JWS + func JWTToJWS(jwt string) (jws *JWS) + func (jws *JWS) DecodeComponents() error + type RSAJWK struct + Exp string + KeyID string + N string + Seed string + Use []string v0.6.2 Oct 2, 2020 Changes in this version + func JWSToJWT(jwt *JWS) string + func Sign(privkey PrivateKey, hash []byte, rand io.Reader) []byte + type JWS struct + Claims Object + Header Object + Payload string + Protected string + Signature string + func SignClaims(privkey PrivateKey, header Object, claims Object) (*JWS, error) + type Object = map[string]interface v0.6.1 Oct 2, 2020 v0.6.0 Oct 2, 2020 Changes in this version + func MarshalDERPrivateKey(privkey PrivateKey) ([]byte, error) + func MarshalDERPublicKey(pubkey crypto.PublicKey) ([]byte, error) + func MarshalECPrivateKey(k *ecdsa.PrivateKey) []byte + func MarshalJWKPrivateKey(privkey PrivateKey) []byte + func MarshalPEMPrivateKey(privkey PrivateKey) ([]byte, error) + func MarshalPEMPublicKey(pubkey crypto.PublicKey) ([]byte, error) + func MarshalRSAPrivateKey(pk *rsa.PrivateKey) []byte type PrivateKey + func NewDefaultPrivateKey() PrivateKey v0.5.2 May 10, 2020 Changes in this version + const ErrDevBadKeyType + const ErrDevSwapPrivatePublic + var ErrInvalidCurve = errors.New("The JWK's 'crv' must be either of the NIST standards 'P-256' or 'P-384'") + var ErrInvalidKeyType = errors.New("The JWK's 'kty' must be either 'RSA' or 'EC'") + var ErrInvalidPrivateKey = errors.New("PrivateKey must be of type *rsa.PrivateKey or *ecdsa.PrivateKey") + var ErrInvalidPublicKey = errors.New("PublicKey must be of type *rsa.PublicKey or *ecdsa.PublicKey") + var ErrParseJWK = errors.New("JWK is missing required base64-encoded JSON fields") + var ErrParsePrivateKey = errors.New(...) + var ErrParsePublicKey = errors.New(...) + var ErrUnexpectedPrivateKey = errors.New("PublicKey was given where PrivateKey was expected") + var ErrUnexpectedPublicKey = errors.New("PrivateKey was given where PublicKey was expected") + func MarshalECPublicKey(k *ecdsa.PublicKey, exp ...time.Time) []byte + func MarshalECPublicKeyWithoutKeyID(k *ecdsa.PublicKey) []byte + func MarshalJWKPublicKey(key PublicKey, exp ...time.Time) []byte + func MarshalRSAPublicKey(p *rsa.PublicKey, exp ...time.Time) []byte + func MarshalRSAPublicKeyWithoutKeyID(p *rsa.PublicKey) []byte + func ThumbprintECPublicKey(k *ecdsa.PublicKey) string + func ThumbprintPublicKey(pub PublicKey) string + func ThumbprintRSAPublicKey(p *rsa.PublicKey) string + func ThumbprintUntypedPublicKey(pub crypto.PublicKey) string + type ECPublicKey struct + Expiry time.Time + KID string + PublicKey *ecdsa.PublicKey + func (p *ECPublicKey) ExpireAt(t time.Time) + func (p *ECPublicKey) ExpiresAt() time.Time + func (p *ECPublicKey) Key() crypto.PublicKey + func (p *ECPublicKey) KeyID() string + func (p *ECPublicKey) Thumbprint() string + type PrivateKey interface + Public func() crypto.PublicKey + func ParseJWKPrivateKey(b []byte) (PrivateKey, error) + func ParsePrivateKey(block []byte) (PrivateKey, error) + func ParsePrivateKeyString(block string) (PrivateKey, error) + type PublicKey interface + ExpiresAt func() time.Time + Key func() crypto.PublicKey + KeyID func() string + Thumbprint func() string + func DecodeJWKPublicKey(r io.Reader) (PublicKey, error) + func NewJWKPublicKey(m map[string]string) (PublicKey, error) + func NewPublicKey(pub crypto.PublicKey, kid ...string) PublicKey + func ParseJWKPublicKey(b []byte) (PublicKey, error) + func ParseJWKPublicKeyString(s string) (PublicKey, error) + func ParsePublicKey(block []byte) (PublicKey, error) + func ParsePublicKeyString(block string) (PublicKey, error) + type RSAPublicKey struct + Expiry time.Time + KID string + PublicKey *rsa.PublicKey + func (p *RSAPublicKey) ExpireAt(t time.Time) + func (p *RSAPublicKey) ExpiresAt() time.Time + func (p *RSAPublicKey) Key() crypto.PublicKey + func (p *RSAPublicKey) KeyID() string + func (p *RSAPublicKey) Thumbprint() string