func CertificateToPemWriter(writer io.Writer, headers map[string]string,
	cert *x509.Certificate, chain ...*x509.Certificate) error {
	for _, cert := range append([]*x509.Certificate{cert}, chain...) {
		err := pem.Encode(writer, &pem.Block{
			Bytes: cert.Raw,
			//TODO re-enable headers on certificate to pem when Juju upgrade
			//CAAS mongo to something compiled with latest openssl. Currently
			//not all our Openssl versions support pem headers. Make sure to
			//also uncomment test.
			//Headers: headers,
			Type: PEMTypeCertificate,
		})
		if err != nil {
			return errors.Annotate(err, "encoding certificate to pem format")
		}
	}
	return nil
}
// CertificateToPemWriter transforms an x509 certificate to pem format on the
// supplied writer
CertificateToPemWriter transforms an x509 certificate to pem format on the
supplied writer
// CertificateToPemWriter transforms an x509 certificate to pem format on the // supplied writer
func CertificateToPemWriter(writer io.Writer, headers map[string]string,
	cert *x509.Certificate, chain ...*x509.Certificate) error {
	for _, cert := range append([]*x509.Certificate{cert}, chain...) {
		err := pem.Encode(writer, &pem.Block{
			Bytes: cert.Raw,
			Type: PEMTypeCertificate,
		})
		if err != nil {
			return errors.Annotate(err, "encoding certificate to pem format")
		}
	}
	return nil
}
func CertificateToPemWriter ( writer io . Writer , headers map [ string ] string , cert * x509 . Certificate , chain ... * x509 . Certificate ) error { for _ , cert := range append ( [ ] * x509 . Certificate { cert } , chain ... ) { err := pem . Encode ( writer , & pem . Block { Bytes : cert . Raw , Type : PEMTypeCertificate , } ) if err != nil { return errors . Annotate ( err , " " ) } } return nil }
CertificateToPemWriter transforms an x509 certificate to pem format on the
supplied writer
CertificateToPemWriter transforms an x509 certificate to pem format on the supplied writer
//TODO re-enable headers on certificate to pem when Juju upgrade //CAAS mongo to something compiled with latest openssl. Currently //not all our Openssl versions support pem headers. Make sure to //also uncomment test. //Headers: headers,