Documentation ¶
Index ¶
- func EncodeCertificatePEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func EncodePublicKeyPEM(key *rsa.PublicKey) ([]byte, error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSelfSignedCACertificate(cfg CertConfig, key *rsa.PrivateKey) (*x509.Certificate, error)
- func NewSignedCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func ParsePEMEncodedCACert(pemdata []byte) (*x509.Certificate, error)
- func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
- type AltNames
- type CertConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeCertificatePEM ¶
func EncodeCertificatePEM(cert *x509.Certificate) []byte
EncodeCertificatePEM encodes the given certificate pem and returns bytes (base64).
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM encodes the given private key pem and returns bytes (base64).
func EncodePublicKeyPEM ¶
EncodePublicKeyPEM encodes the given public key pem and returns bytes (base64).
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey returns randomly generated RSA private key.
func NewSelfSignedCACertificate ¶
func NewSelfSignedCACertificate(cfg CertConfig, key *rsa.PrivateKey) (*x509.Certificate, error)
NewSelfSignedCACertificate returns a self-signed CA certificate based on given configuration and private key. The certificate has one-year lease.
func NewSignedCertificate ¶
func NewSignedCertificate(cfg CertConfig, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)
NewSignedCertificate signs a certificate using the given private key, CA and returns a signed certificate. The certificate could be used for both client and server auth. The certificate has one-year lease.
func ParsePEMEncodedCACert ¶
func ParsePEMEncodedCACert(pemdata []byte) (*x509.Certificate, error)
ParsePEMEncodedCACert parses a certificate from the given pemdata
func ParsePEMEncodedPrivateKey ¶
func ParsePEMEncodedPrivateKey(pemdata []byte) (*rsa.PrivateKey, error)
ParsePEMEncodedPrivateKey parses a private key from given pemdata
Types ¶
type AltNames ¶
AltNames contains the domain names and IP addresses that will be added to the API Server's x509 certificate SubAltNames field. The values will be passed directly to the x509.Certificate object.
func NewAltNames ¶
NewAltNames parses given addrs into either ip or dns name, and returns Altnames for them.
type CertConfig ¶
CertConfig is a common struct containing fields to create a cert