MCPcopy Create free account
hub / github.com/bytebase/bytebase / validateInlineCertPEM

Function validateInlineCertPEM

backend/api/v1/instance_service.go:343–362  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

341}
342
343func validateInlineCertPEM(data []byte) error {
344 var certs [][]byte
345 for {
346 var block *pem.Block
347 block, data = pem.Decode(data)
348 if block == nil {
349 break
350 }
351 if block.Type == "CERTIFICATE" {
352 certs = append(certs, block.Bytes)
353 }
354 }
355 if len(certs) == 0 {
356 return errors.New("no CERTIFICATE PEM block found")
357 }
358 if _, err := x509.ParseCertificate(certs[0]); err != nil {
359 return err
360 }
361 return nil
362}
363
364func validateInlineKeyPEM(data []byte) error {
365 var block *pem.Block

Callers 1

Calls 1

DecodeMethod · 0.80

Tested by

no test coverage detected