Documentation ¶
Index ¶
- func GenerateCACert() (*x509.Certificate, crypto.PrivateKey, error)
- func GenerateSignedCert(ca *x509.Certificate, caKey crypto.PrivateKey, names ...string) (*x509.Certificate, crypto.PrivateKey, error)
- func PEMEncode(cert *x509.Certificate, key crypto.PrivateKey) ([]byte, []byte, error)
- func VerifySignedCert(certDER []byte, ca *x509.Certificate) ([]string, error)
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.