x509

package
v0.0.0-...-a7f31ed Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(cn, hosts string) ([]byte, *rsa.PrivateKey, error)

Generate a key and cert

func GenerateAndWrite

func GenerateAndWrite(cn, hosts, certPath, keyPath string, force bool) error

GenerateAndWrite generate a certificate and key and save to the given paths. Do not overwrite unless force is true.

func GenerateCertAndKey

func GenerateCertAndKey(cn, hosts string) (*x509.Certificate, *rsa.PrivateKey, error)

GenerateCertAndKey generate a certificate and a key, and return as x509.Certificate and rsa.PrivateKey

func ParseCert

func ParseCert(b []byte) (*x509.Certificate, error)

ParseCert parse a cert from a PEM-encoded byte slice

func ParseCertFromBlock

func ParseCertFromBlock(b []byte) ([]*x509.Certificate, error)

ParseCertFromBlock process pem certificates

func PemEncodeCert

func PemEncodeCert(cert []byte) []byte

PemEncodeCert take certificate DER bytes and PEM encode them

func PemEncodeKey

func PemEncodeKey(key *rsa.PrivateKey) []byte

PemEncodeKey take an RSA private key and PEM encode it

func ReadCert

func ReadCert(p string) (*x509.Certificate, error)

ReadCert read a cert file

func WriteCert

func WriteCert(cert []byte, certPath string, force bool) error

WriteCert write cert bytes to a path, after pem encoding them. Do not overwrite unless force is true.

func WriteKey

func WriteKey(key *rsa.PrivateKey, keyPath string, force bool) error

WriteKey write RSA private key to a path, after pem encoding it. Do not overwrite unless force is true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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