pki

package
v0.0.0-...-7c1aaf1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CaExpirey time.Time = time.Now().AddDate(10, 0, 0)
View Source
var CertExpirey time.Time = time.Now().AddDate(3, 0, 0)

Functions

func GenCA

func GenCA(caKey ed25519.PrivateKey) []byte

Take a privat key object and a hostname and return a PEM encoded CA with the commonname of the hostname

func GenCSR

func GenCSR(privKey any, hostname string) []byte

Take a private key, a hostname, and a path, create a CSR with the CN and the DNSNames as the hostname and return a PEM encoded CSR

func GenKey

func GenKey() []byte

Output a pem and der encoded ed25519 private key

func PemSum

func PemSum(pemBytes []byte) string

Return the sum of any PEM encoded object

func ReadCSR

func ReadCSR(certPEMBytes []byte) *x509.CertificateRequest

Take a PEM encoded DER encoded csr and return the *x509.CertificateRequest object

func ReadCrt

func ReadCrt(certPEMBytes []byte) *x509.Certificate

Take a PEM encoded DER encoded cert and return the *x509.Certificate object

func ReadKey

func ReadKey(keyPEMBytes []byte) ed25519.PrivateKey

Take a PEM encoded SEC1,ASN1 DER private key and return the *ed25519.PrivateKey object

func SignCrt

func SignCrt(caCert *x509.Certificate, caPriv ed25519.PrivateKey, csr *x509.CertificateRequest) []byte

Take a CA cert object, private key of the CA, a CSR, and a path to write the cert Generate a cert from the CSA and sign with the CA supplied

func VerifyCrt

func VerifyCrt(caCert *x509.Certificate, cert *x509.Certificate) error

Verify if a cert was signed by the CA

Types

This section is empty.

Jump to

Keyboard shortcuts

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