jwk

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jwk provides JSON Web Key (JWK) structure and methods to decode it to public and private keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Alg string `json:"alg"`           // algorithm
	Crv string `json:"crv,omitempty"` // curve - for EC keys
	D   string `json:"d"`             // private exponent
	DP  string `json:"dp"`            // d mod (p-1)
	DQ  string `json:"dq"`            // d mod (p-1)
	E   string `json:"e"`             // public exponent
	K   string `json:"k,omitempty"`   // symmetric key
	Kid string `json:"kid"`           // Key ID
	Kty string `json:"kty"`           // Key Type
	N   string `json:"n"`             // modulus
	P   string `json:"p"`             // prime factor 1
	Q   string `json:"q"`             // prime factor 2
	QI  string `json:"qi"`            // q^(-1) mod p
	Use string `json:"use"`
	X   string `json:"x,omitempty"` // x coordinate - for EC keys
	Y   string `json:"y,omitempty"` // y coordinate - for EC keys
}

Key defines JSON Web Key structure.

func (*Key) DecodePrivateKey

func (j *Key) DecodePrivateKey() (crypto.PrivateKey, error)

DecodePrivateKey decodes Key to private key.

func (*Key) DecodePublicKey

func (j *Key) DecodePublicKey() (crypto.PublicKey, error)

DecodePublicKey decodes Key to public key.

Jump to

Keyboard shortcuts

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