x509

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PEMTypePrivateKey  string = "RSA PRIVATE KEY"
	PEMTypePublicKey   string = "PUBLIC KEY"
	PEMTypeCertificate string = "CERTIFICATE"
)

Variables

This section is empty.

Functions

func GetNameInfoFromX509Cert

func GetNameInfoFromX509Cert(cert *x509.Certificate) string

get signer name info from cert try finding it in the following order - cert.EmailAddress - cert.Subject.Names[] - cert.Subject.CommonName - SubjectAlternativeName (SAN) in cert.Extensions[]

func GetPublicKeyFromCertificate

func GetPublicKeyFromCertificate(certPemBytes []byte) ([]byte, error)

extract public key of certificate

func LoadCertificate

func LoadCertificate(certPath string) (*x509.Certificate, error)

Load certificate at `certPath` Specifying a cert secret with `k8s://` prefix is supported.

func LoadCertificateChain added in v0.4.0

func LoadCertificateChain(certChainPath string) ([]*x509.Certificate, error)

Load certificate chain at `certChainPath` Specifying a cert secret with `k8s://` prefix is supported.

func PEMDecode

func PEMDecode(pemBytes []byte, mode string) []byte

Decode PEM bytes of x509 private key / public key / certificate

func VerifyBlob

func VerifyBlob(msgBytes, sigBytes, certBytes []byte, caCertPathString *string) (bool, string, *int64, error)

Verify certificate with CA cert, then verify signature

Types

This section is empty.

Jump to

Keyboard shortcuts

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