MCPcopy Index your code
hub / github.com/coder/coder / ParseCertificates

Function ParseCertificates

coderd/azureidentity/azureidentity.go:324–338  ·  view source on GitHub ↗

ParseCertificates parses the hardcoded Azure intermediate certificates and returns them as x509.Certificate values.

()

Source from the content-addressed store, hash-verified

322// ParseCertificates parses the hardcoded Azure intermediate
323// certificates and returns them as x509.Certificate values.
324func ParseCertificates() ([]*x509.Certificate, error) {
325 var certs []*x509.Certificate
326 for _, certPEM := range Certificates {
327 block, rest := pem.Decode([]byte(certPEM))
328 if len(rest) != 0 {
329 return nil, xerrors.Errorf("invalid certificate. %d bytes remain", len(rest))
330 }
331 cert, err := x509.ParseCertificate(block.Bytes)
332 if err != nil {
333 return nil, xerrors.Errorf("parse certificate: %w", err)
334 }
335 certs = append(certs, cert)
336 }
337 return certs, nil
338}
339
340// Certificates are manually downloaded from Azure, then processed with OpenSSL
341// and added here. See: https://learn.microsoft.com/en-us/azure/security/fundamentals/azure-ca-details

Callers 2

TestExpiresSoonFunction · 0.92
ValidateFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by 1

TestExpiresSoonFunction · 0.74