Documentation ¶
Index ¶
- Constants
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func MarshalPrivateKeyToPEM(privateKey crypto.PrivateKey) ([]byte, error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, error)
- func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)
- type AltNames
- type Config
- type SelfSignedCert
- type Signer
Constants ¶
const ( // ECPrivateKeyBlockType is a possible value for pem.Block.Type. ECPrivateKeyBlockType = "EC PRIVATE KEY" // RSAPrivateKeyBlockType is a possible value for pem.Block.Type. RSAPrivateKeyBlockType = "RSA PRIVATE KEY" )
Variables ¶
This section is empty.
Functions ¶
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-endcoded certificate data
func MarshalPrivateKeyToPEM ¶
func MarshalPrivateKeyToPEM(privateKey crypto.PrivateKey) ([]byte, error)
MarshalPrivateKeyToPEM converts a known private key type of RSA or ECDSA to a PEM encoded block or returns an error.
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key
func NewSelfSignedCACert ¶
NewSelfSignedCACert creates a CA certificate
func NewSignedCert ¶
func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) (*x509.Certificate, error)
NewSignedCert creates a signed certificate using the given CA certificate and key
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.
type Config ¶
type Config struct { CommonName string Organization []string AltNames AltNames Usages []x509.ExtKeyUsage }
Config contains the basic fields required for creating a certificate
type SelfSignedCert ¶
func NewSelfSignedCertOrDie ¶
func NewSelfSignedCertOrDie(names []string) *SelfSignedCert
NewSelfSignedCertOrDie is a factory to generate very basic self signed certs good for a year. It returns a struct of the three files for self signed certs. It does not save a file.
func (*SelfSignedCert) UpdateTLS ¶ added in v1.1.0
func (s *SelfSignedCert) UpdateTLS() error
UpdateTLS uses the same signing certificate to issue a new tls certificate