Documentation ¶
Index ¶
- Constants
- func EncodeCertificatePEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func NewClientCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewServerCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)
- func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
- type AltNames
- type CertConfig
Constants ¶
View Source
const ( RSAKeySize = 2048 Duration365d = time.Hour * 24 * 365 )
Certificate and key constants.
Variables ¶
This section is empty.
Functions ¶
func EncodeCertificatePEM ¶
func EncodeCertificatePEM(cert *x509.Certificate) []byte
EncodeCertificatePEM returns encoded bytes for the given Certificate.
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM returns encoded bytes of the given private key.
func NewClientCertificate ¶
func NewClientCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey, customDuration *time.Duration) (*x509.Certificate, error)
NewClientCertificate returns a new x509 client certificate, signed by the CA with the given certificate and key.
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey returns a new private key.
func NewServerCertificate ¶
func NewServerCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey, customDuration *time.Duration) (*x509.Certificate, error)
NewServerCertificate returns a new x509 server certificate, signed by the CA with the given certificate and key.
func ParsePEMEncodedCert ¶
func ParsePEMEncodedCert(pemdata []byte) (*x509.Certificate, error)
ParsePEMEncodedCert parses raw certificate bytes and returns an x509 Certificate.
func ParsePEMEncodedPrivateKey ¶
func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
ParsePEMEncodedPrivateKey parses raw private keys and returns a private key.
Types ¶
type CertConfig ¶
CertConfig is the TLS distinguished name configuration.
Click to show internal directories.
Click to hide internal directories.