code: func ParseCertificatesPEM(certsPEM []byte) ([]*x509.Certificate, error) {
  	var certs []*x509.Certificate
  	var err error
  	certsPEM = bytes.TrimSpace(certsPEM)
  	for len(certsPEM) > 0 {
  		var cert []*x509.Certificate
  		cert, certsPEM, err = ParseOneCertificateFromPEM(certsPEM)
  		if err != nil {
  
  			return nil, cferr.New(cferr.CertificateError, cferr.ParseFailed)
  		} else if cert == nil {
  			break
  		}
  
  		certs = append(certs, cert...)
  	}
  	if len(certsPEM) > 0 {
  		return nil, cferr.New(cferr.CertificateError, cferr.DecodeFailed)
  	}
  	return certs, nil
  }
docs: // ParseCertificatesPEM parses a sequence of PEM-encoded certificate and returns them,
  // can handle PEM encoded PKCS #7 structures.