INNER CODE UNIT · Go

parseCertificate

go-piv/go-ykpiv · attestation_test.go:150

func parseCertificate(pemBytes []byte) (*x509.Certificate, error) {
	parsed, _ := pem.Decode(pemBytes)
	if parsed == nil {
		return nil, fmt.Errorf("could not parse pem block")
	}
	return x509.ParseCertificate(parsed.Bytes)
}

func parseCABundle(bundle [][]byte) (x509.VerifyOptions, error) {
	options := x509.VerifyOptions{
		Intermediates: x509.NewCertPool(),
		Roots:         x509.NewCertPool(),
	}

	for _, certBytes := range bundle {
		parsed, _ := pem.Decode(certBytes)
		certificate, err := x509.ParseCertificate(parsed.Bytes)
		if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…