hostconf_jwk

package
v0.0.0-...-6f43059 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const KeyCurve = jwa.P256

Variables

This section is empty.

Functions

func DecryptJWK

func DecryptJWK(aeskey []byte, encrypted []byte) (jwkey jwk.Key, err error)

Decrypt an AES-GCM encrypted JWK

func EncryptJWK

func EncryptJWK(aeskey []byte, jwkey jwk.Key) (enc []byte, err error)

Encrypt a JWK Key with encryption key Uses AES-GCM with a random nonce. The nonce is pre-pended to ciphertext.

func GeneratePrivateJWK

func GeneratePrivateJWK(expiration time.Time) (key jwk.Key, err error)

Generate a private key with additional properties alg: based on key type (ES256 for P256) exp: expiration time (Unix timestamp) kid: base64 SHA-256 thumbprint use: "sig"

func GetPublicJWK

func GetPublicJWK(key jwk.Key) (jwk.Key, error)

Get public key of a JWK

func KeyStateString

func KeyStateString(state KeyState) string

func ParseJWKSet

func ParseJWKSet(src []byte) (rs jwk.Set, err error)

Parse and validate a JWKSet

Types

type KeyState

type KeyState int

JWK key state

const (
	ValidKey KeyState = iota
	ExpiredKey
	InvalidKey
	RevokedKey
	EncryptionIdMismatch
	KeyDecryptionFailed
)

func ParseJWK

func ParseJWK(src []byte) (key jwk.Key, state KeyState, err error)

Parse and validate a single JWK

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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