jwk

package
v0.0.0-...-c26a47f Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToString

func EncodeToString(b []byte) string

EncodeToString encodes a string to be used in a JWK

func NewSerialNumber

func NewSerialNumber() (*big.Int, error)

NewSerialNumber returns a new serial number to be used in creating a Certificate

func NewTemplate

func NewTemplate(subject pkix.Name, ipAddrs, dnsNames []string) (*x509.Certificate, error)

NewTemplate returns a new Certificate using default values

Types

type Certificate

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

Certificate represents a JWK certificate

func NewCertificate

func NewCertificate(cert io.Reader) (Certificate, error)

NewCertificate returns a new Certificate from the given PEM encoded cert

func (Certificate) E

func (cert Certificate) E() string

E returns the encoded exponent part of the RSA public key

func (Certificate) KeyID

func (cert Certificate) KeyID() (string, error)

KeyID returns the key identity of the Certificate's RSA public key

func (Certificate) N

func (cert Certificate) N() string

E returns the encoded modulas part of the RSA public key

func (Certificate) PublicKey

func (cert Certificate) PublicKey() ([]byte, error)

PublicKey returns the Certificate's RSA public key in PEM format

func (Certificate) ToJwk

func (cert Certificate) ToJwk() (Jwk, error)

ToJwk returns the JSON Web Key (JWK) of the certificate

func (Certificate) ToPem

func (cert Certificate) ToPem() (string, error)

ToPem returns the Certificate in PEM format

func (Certificate) X5C

func (cert Certificate) X5C() ([]string, error)

X5C return the x.509 certificate chain in PEM form

func (Certificate) X5T

func (cert Certificate) X5T() (string, error)

X5T returns the encoded SHA-1 sum of the Certificate

type Jwk

type Jwk struct {
	Alg string   `json:"alg"` // Version of cryptographic algorithm
	KTy string   `json:"kty"` // Cryptographic algorithm
	KID string   `json:"kid"` // Key ID
	Use string   `json:"use"` // Use of key
	N   string   `json:"n"`   // The modulas of the RSA key
	E   string   `json:"e"`   // The exponent of the RSA key
	X5C []string `json:"x5c"` // The x.509 certificate chain
	X5T string   `json:"x5t"` // Thumbprint of x.509 cert (SHA-1)
}

Jwk represents a JSON Web Key

type Jwks

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

Jwks represent a list of JSON Web Keys

Jump to

Keyboard shortcuts

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