In Go there is a function:
func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool)
but there is no way to do the opposite.
How would I convert the x509.CertPool to PEM bytes?
The struct field containing the []*Certificate
is unexported, and there are no functions that expose them. Likely to protect them from exactly what you are wanting to do. Thus, using the package as-is, there is no way to do this. There are also no interface
s defined, so you wouldn't be able to provide your own implementation of a CertPool
with this added functionality either.