Documentation ¶
Overview ¶
Package triple generates key-certificate pairs for the triple (CA, Server, Client).
Index ¶
- Constants
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSignedCert(cfg certutil.Config, key crypto.Signer, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
- func ParsePrivateKeyPEM(keyData []byte) (interface{}, error)
- type KeyPair
- func NewCA(name string) (*KeyPair, error)
- func NewClientKeyPair(ca *KeyPair, commonName string, organizations []string) (*KeyPair, error)
- func NewServerKeyPair(ca *KeyPair, commonName, svcName, svcNamespace, dnsDomain string, ...) (*KeyPair, error)
- func ParseRSAKeyPair(certPEM, keyPEM []byte) (*KeyPair, error)
Constants ¶
const ( RSAPrivateKeyBlockType = "RSA PRIVATE KEY" // ECPrivateKeyBlockType is a possible value for pem.Block.Type. ECPrivateKeyBlockType = "EC PRIVATE KEY" PrivateKeyBlockType = "PRIVATE KEY" CertificateBlockType = "CERTIFICATE" )
Variables ¶
This section is empty.
Functions ¶
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-encoded certificate data.
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM returns PEM-encoded private key data.
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key.
func NewSignedCert ¶
func NewSignedCert(cfg certutil.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.
func ParseCertsPEM ¶
func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
ParseCertsPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates.
func ParsePrivateKeyPEM ¶
ParsePrivateKeyPEM returns a private key parsed from a PEM block in the supplied data. Recognizes PEM blocks for "EC PRIVATE KEY", "RSA PRIVATE KEY", or "PRIVATE KEY".
Types ¶
type KeyPair ¶
type KeyPair struct { Key *rsa.PrivateKey Cert *x509.Certificate }