code: func DecodeAllCerts(pfxData []byte, password string) (certificates []*x509.Certificate, err error) {
  	encodedPassword, err := bmpString(password)
  	if err != nil {
  		return nil, err
  	}
  
  	bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)
  	if err != nil {
  		return nil, err
  	}
  
  	certificates = []*x509.Certificate{}
  	for _, bag := range bags {
  		switch {
  		case bag.Id.Equal(oidCertBag):
  			certsData, err := decodeCertBag(bag.Value.Bytes)
  			if err != nil {
  				return nil, err
  			}
  			certs, err := x509.ParseCertificates(certsData)
  			if err != nil {
  				return nil, err
  			}
  			if len(certs) != 1 {
  				err = errors.New("pkcs12: expected exactly one certificate in the certBag")
  				return nil, err
  			}
  			certificates = append(certificates, certs[0])
  		}
  	}
  
  	if certificates == nil || len(certificates) == 0 {
  		return nil, errors.New("pkcs12: certificate missing")
  	}
  
  	return
  }
docs: // DecodeAllCerts extracts a certificates from pfxData.