MCPcopy Create free account
hub / github.com/conforma/cli / getPublicKeyOrCert

Function getPublicKeyOrCert

acceptance/image/image.go:1383–1395  ·  view source on GitHub ↗

getPublicKeyOrCert returns the cert if we have it, otherwise return public key This mimics the same logic used in Tekton Chains

(signer signature.SignerVerifier)

Source from the content-addressed store, hash-verified

1381// getPublicKeyOrCert returns the cert if we have it, otherwise return public key
1382// This mimics the same logic used in Tekton Chains
1383func getPublicKeyOrCert(signer signature.SignerVerifier) ([]byte, error) {
1384 // For now, we'll always use the public key since we're using test keys
1385 // In a real scenario with certificates, we'd check for cert first
1386 pub, err := signer.PublicKey()
1387 if err != nil {
1388 return nil, fmt.Errorf("getting public key: %w", err)
1389 }
1390 pem, err := cryptoutils.MarshalPublicKeyToPEM(pub)
1391 if err != nil {
1392 return nil, fmt.Errorf("key to pem: %w", err)
1393 }
1394 return pem, nil
1395}
1396
1397func applyPatches(statement *in_toto.ProvenanceStatementSLSA02, patches *godog.Table) (*in_toto.ProvenanceStatementSLSA02, error) {
1398 if statement == nil || patches == nil || len(patches.Rows) == 0 {

Callers 1

uploadToTransparencyLogFunction · 0.85

Calls 2

ErrorfMethod · 0.65
PublicKeyMethod · 0.45

Tested by

no test coverage detected