crypto

package
v0.0.0-...-f456f9b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyUseSignature string = "sig"
	KeyAlgorithm    string = "RS256"
)
View Source
const SigningAlg = jose.RS256

Variables

This section is empty.

Functions

func ConvertPEMChainToX509Chain

func ConvertPEMChainToX509Chain(pemChain []byte) ([]*x509.Certificate, error)

func GenerateJwk

func GenerateJwk() (*jose.JSONWebKey, error)

func GenerateJwt

func GenerateJwt(signer jose.Signer, claims interface{}) (string, error)

func GenerateRSAKey

func GenerateRSAKey() (*rsa.PrivateKey, error)

func GetPreviousJwkFromSecret

func GetPreviousJwkFromSecret(managedSecrets *kubernetes.SecretLists, secretKey string) (*jose.JSONWebKey, error)

func KeyIDsFromJwks

func KeyIDsFromJwks(jwks *jose.JSONWebKeySet) []string

func MergeJwks

func MergeJwks(jwk jose.JSONWebKey, secretsInUse v1.SecretList, secretKey string) (*jose.JSONWebKeySet, error)

func NewKmsSigner

func NewKmsSigner(certChain []byte, kmsConfig config.KMS, ctx context.Context) (jose.Signer, error)

func SetupSignerOptions

func SetupSignerOptions(pemChain []byte) (*jose.SignerOptions, error)

func X5tS256

func X5tS256(cert *x509.Certificate) string

X5tS256 creates a base64url-encoded SHA-256 thumbprint of the given input certificate, as described in RFC 7517 section 4.9, i.e. the "x5t#S256" property.

Types

type ByteSigner

type ByteSigner interface {
	SignBytes(payload []byte) ([]byte, error)
}

type ConfigurableSigner

type ConfigurableSigner struct {
	SignerOptions *jose.SignerOptions
	ByteSigner    ByteSigner
}

func (ConfigurableSigner) Options

func (ctx ConfigurableSigner) Options() jose.SignerOptions

func (ConfigurableSigner) Sign

func (ctx ConfigurableSigner) Sign(payload []byte) (*jose.JSONWebSignature, error)

type KmsByteSigner

type KmsByteSigner struct {
	Client        *kms.KeyManagementClient
	Ctx           context.Context
	SignerOptions *jose.SignerOptions
	KmsKeyPath    KmsKeyPath
}

func (KmsByteSigner) SignBytes

func (k KmsByteSigner) SignBytes(payload []byte) ([]byte, error)

type KmsKeyPath

type KmsKeyPath string

type KmsOptions

type KmsOptions struct {
	Client    *kms.KeyManagementClient
	Ctx       context.Context
	KmsConfig config.KMS
}

Jump to

Keyboard shortcuts

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