certs

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCACert

func GenerateCACert() (*x509.Certificate, crypto.PrivateKey, error)

GenerateCACert generates a self-signed CA certificate and a corresponding private key.

The returned certificate has a one-year validity and is attributed to a fake authority. As such, it should only ever be used on a temporary basis and for in-process certificate signing.

func GenerateSignedCert

func GenerateSignedCert(ca *x509.Certificate, caKey crypto.PrivateKey, names ...string) (*x509.Certificate, crypto.PrivateKey, error)

GenerateSignedCert generates a certificate for the given DNS names, signed by the given Certificate Authority, and a corresponding private key.

The returned certificate has a one-year validity and should only ever be used on a temporary basis.

func PEMEncode

func PEMEncode(cert *x509.Certificate, key crypto.PrivateKey) ([]byte, []byte, error)

PEMEncode returns the PEM-encoded blocks for the given certificate and private key.

func VerifySignedCert

func VerifySignedCert(certDER []byte, ca *x509.Certificate) ([]string, error)

VerifySignedCert verifies the given signed certificate using the given root CA, returning the DNS names stored in the leaf certificate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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