Skip to content

Bug: rootCA certificate parsing missing PEM decode step #1666

@realyota

Description

@realyota

Here:

if cert, err := x509.ParseCertificate([]byte(c.params.rootCA)); err != nil {

x509.ParseCertificate expects DER-encoded ASN.1 data: https://pkg.go.dev/crypto/x509#ParseCertificate

| ParseCertificate parses a single certificate from the given ASN.1 DER data.

Certificates in ConfigMaps are typically stored in PEM format
Need to use pem.Decode to convert from PEM to DER before parsing.

Tests: https://github.com/golang/go/blob/9ce47e66e8eb7348005f1e45a77a729e7f146a1e/src/crypto/x509/x509_test.go#L601

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions