x509util

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 9 Imported by: 6

Documentation

Overview

Package x509util provides utility functions to process X509 certificates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGroupList

func GetGroupList(cert *x509.Certificate) (map[string]struct{}, error)

GetGroupList decodes the list of groups in the certificate. The group names are returned as keys in a map. An empty map indicates no group listed. If there is a problem parsing the information an error is returned.

func GetPermittedMethods

func GetPermittedMethods(cert *x509.Certificate) (map[string]struct{}, error)

GetPermittedMethods decodes the list of permitted methods in the certificate. The permitted methods are returned as keys in a map. An empty map indicates no methods are permitted. If there is a problem parsing the information an error is returned.

func GetUsername

func GetUsername(cert *x509.Certificate) (string, error)

GetUsername decodes the username for whom the certificate was granted. It attests the identity of the user.

func LoadCertificatePEM added in v0.9.0

func LoadCertificatePEM(filename string,
	logger log.DebugLogger) (*x509.Certificate, map[string]string, error)

LoadCertificatePEM will decode the certificate found in the specified file containing PEM data. It returns the certificate and PEM headers if found, else an error. If there are extra data a message is logged.

func LoadCertificatePEMs added in v0.9.0

func LoadCertificatePEMs(filename string) (
	[]*x509.Certificate, []map[string]string, error)

LoadCertificatePEMs will decode all the certificates found in the specified file containing PEM data. It returns a slice of certificates and a slice of PEM headers on success, else an error. If no certificates are found, an empty slice is returned. If no PEM headers are found in any PEM block, an empty slice is returned.

func ParseCertificatePEM added in v0.9.0

func ParseCertificatePEM(pemData []byte,
	logger log.DebugLogger) (*x509.Certificate, map[string]string, error)

ParseCertificatePEM will decode the certificate found in the specified PEM data. It returns the certificate and PEM headers if found, else an error. If there are extra data a message is logged.

func ParseCertificatePEMs added in v0.9.0

func ParseCertificatePEMs(pemData []byte) (
	[]*x509.Certificate, []map[string]string, error)

ParseCertificatePEMs will decode all the certificates found in the specified PEM data. It returns a slice of certificates and a slice of PEM headers on success, else an error. If no certificates are found, an empty slice is returned. If no PEM headers are found in any PEM block, an empty slice is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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