Documentation ¶
Index ¶
- Constants
- func DecodeCertificate(raw []byte) (cert *x509.Certificate, err error)
- func DecodePrivateKeyBytes(keyBytes []byte) (key crypto.Signer, err error)
- func EnsureSecretPassJKS(secret *corev1.Secret) (injected *corev1.Secret, err error)
- func GenerateJKS(certs []*x509.Certificate, privateKey []byte) (out, passw []byte, err error)
- func GenerateJKSFromByte(certByte []byte, privateKey []byte, caCert []byte) (out, passw []byte, err error)
- func GeneratePass(length int) (passw []byte)
- func GeneratePrivateKeyInPemFormat() ([]byte, error)
- func GenerateSigningRequestInPemFormat(priv *rsa.PrivateKey, commonName string, dnsNames []string) ([]byte, error)
- func GenerateTestCert() (cert, key []byte, expectedDn string, err error)
- func GetCertBundle(certContainers []*CertificateContainer) []*x509.Certificate
- type CertificateContainer
Constants ¶
const ( RSAPrivateKeyType = "RSA PRIVATE KEY" PrivateKeyType = "PRIVATE KEY" ECPrivateKeyType = "EC PRIVATE KEY" CertRequestType = "CERTIFICATE REQUEST" )
Variables ¶
This section is empty.
Functions ¶
func DecodeCertificate ¶
func DecodeCertificate(raw []byte) (cert *x509.Certificate, err error)
DecodeCertificate returns an x509.Certificate for a PEM encoded certificate
func DecodePrivateKeyBytes ¶ added in v0.20.1
DecodePrivateKeyBytes will decode a PEM encoded private key into a crypto.Signer. It supports ECDSA, PKCS1, PKCS8 private key format only. All other types will return err.
func EnsureSecretPassJKS ¶
EnsureSecretPassJKS ensures a JKS password is present in a certificate secret
func GenerateJKS ¶
func GenerateJKS(certs []*x509.Certificate, privateKey []byte) (out, passw []byte, err error)
GenerateJKS creates a JKS with a random password from a client cert/key combination
func GenerateJKSFromByte ¶
func GeneratePass ¶
GeneratePass generates a random password
func GeneratePrivateKeyInPemFormat ¶
GeneratePrivateKeyInPemFormat is used to generate a private key in a pem format
func GenerateSigningRequestInPemFormat ¶
func GenerateSigningRequestInPemFormat(priv *rsa.PrivateKey, commonName string, dnsNames []string) ([]byte, error)
GenerateSigningRequestInPemFormat is used to generate a signing request in a pem format
func GenerateTestCert ¶
GenerateTestCert is used from unit tests for generating certificates
func GetCertBundle ¶
func GetCertBundle(certContainers []*CertificateContainer) []*x509.Certificate
Types ¶
type CertificateContainer ¶
type CertificateContainer struct { // Certificate Certificate *x509.Certificate // PEM holds the certificate in PEM format PEM *pem.Block }
func ParseCertificates ¶
func ParseCertificates(data []byte) ([]*CertificateContainer, error)
func (CertificateContainer) ToPEM ¶
func (c CertificateContainer) ToPEM() []byte