// Parse env var containing x509 cert, return error if parsing fails
Parse env var containing x509 cert, return error if parsing fails
// Parse env var containing x509 cert return error if parsing fails
func parseX509CertFromPem(certPEM string) (*x509.Certificate, error) {
	block, _ := pem.Decode([]byte(certPEM))
	if block == nil {
		return nil, errors.New("failed to parse PEM block containing the key")
	}
	priv, err := x509.ParseCertificate(block.Bytes)
	if err != nil {
		return nil, err
	}
	return priv, nil
}
func parseX509CertFromPem ( certPEM string ) ( * x509 . Certificate , error ) { block , _ := pem . Decode ( [ ] byte ( certPEM ) ) if block == nil { return nil , errors . New ( " " ) } priv , err := x509 . ParseCertificate ( block . Bytes ) if err != nil { return nil , err } return priv , nil }
Parse env var containing x509 cert, return error if parsing fails
Parse env var containing x509 cert return error if parsing fails