Documentation
¶
Index ¶
- Variables
- func EncodeCertificate(cert *x509.Certificate) []byte
- func EncodePrivateKey(key *rsa.PrivateKey) []byte
- func GenerateCA(validYears int) (*rsa.PrivateKey, *x509.Certificate, error)
- func GenerateClientCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, validYears int) (*rsa.PrivateKey, *x509.Certificate, error)
- func GenerateServerCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, validYears int, ...) (*rsa.PrivateKey, *x509.Certificate, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Cmd = &cobra.Command{
Use: "certs",
Short: "Generate mTLS certificates (CA, server, client)",
RunE: runGenerate,
}
)
Functions ¶
func EncodeCertificate ¶
func EncodeCertificate(cert *x509.Certificate) []byte
EncodeCertificate encodes a certificate to PEM format
func EncodePrivateKey ¶
func EncodePrivateKey(key *rsa.PrivateKey) []byte
EncodePrivateKey encodes a private key to PEM format
func GenerateCA ¶
func GenerateCA(validYears int) (*rsa.PrivateKey, *x509.Certificate, error)
GenerateCA generates a CA certificate
func GenerateClientCert ¶
func GenerateClientCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, validYears int) (*rsa.PrivateKey, *x509.Certificate, error)
GenerateClientCert generates a client certificate
func GenerateServerCert ¶
func GenerateServerCert(caKey *rsa.PrivateKey, caCert *x509.Certificate, validYears int, dnsNames []string) (*rsa.PrivateKey, *x509.Certificate, error)
GenerateServerCert generates a server certificate with the specified DNS names
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.