utils

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPemCertificateChainToX5cFormat

func ConvertPemCertificateChainToX5cFormat(certs []*x509.Certificate) ([]string, error)

func CreateX509VerifyOptionsFromCertChain

func CreateX509VerifyOptionsFromCertChain(pemChainData ...[]byte) (*x509.VerifyOptions, error)

CreateX509VerifyOptionsFromCertChain creates x509.VerifyOptions that can be added to the `VerificationContext` as the trusted certificate chain.

func ExtractOptionalWith

func ExtractOptionalWith[T any](claims map[string]any, key string, valueParser func(any) (T, error)) (T, error)

func GetMapKeys

func GetMapKeys(m map[string]string) []string

func GetOptional

func GetOptional[T any](token jwt.Token, key string) T

func GetRevocationListsForIssuer

func GetRevocationListsForIssuer(authorityKeyId []byte, issuer pkix.Name, revocationLists []*x509.RevocationList) []*x509.RevocationList

func ObtainIssuerUrlFromCertChain

func ObtainIssuerUrlFromCertChain(certChain []*x509.Certificate) (string, error)

func ParsePemCertificateChain

func ParsePemCertificateChain(data []byte) ([]*x509.Certificate, error)

ParsePemCertificateChain takes in the raw contents of a PEM formatted certificate file and returns the contents as a list of x509 certificates.

func ParsePemCertificateChainToX5cFormat

func ParsePemCertificateChainToX5cFormat(data []byte) ([]string, error)

ParsePemCertificateChainToX5cFormat takes in the raw contents of a PEM formatted certificate file and returns the contents of the chain in the format expected as the `x5c` header parameter of a jwt.

func VerifyCertificateAgainstIssuerRevocationLists

func VerifyCertificateAgainstIssuerRevocationLists(cert *x509.Certificate, revocationLists []*x509.RevocationList) error

func VerifyCertificateUri

func VerifyCertificateUri(cert *x509.Certificate, uri string) error

func VerifyRevocationListsSignatures

func VerifyRevocationListsSignatures(parentCert *x509.Certificate, revocationLists []*x509.RevocationList) error

VerifyRevocationListsSignatures verifies the signatures of the revocation lists for a given parent certificate. In case of a revocation list for the root certificate, this will verify for the root certificate itself.

Types

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T comparable]() *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(val T)

func (*Set[T]) Contains

func (s *Set[T]) Contains(val T) bool

func (*Set[T]) Delete

func (s *Set[T]) Delete(val T)

func (*Set[T]) Len

func (s *Set[T]) Len() int

func (*Set[T]) Values

func (s *Set[T]) Values() iter.Seq[T]

Jump to

Keyboard shortcuts

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