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

Function SetTestCTLogPublicKey

internal/utils/testing_sigstore.go:109–118  ·  view source on GitHub ↗

SetTestCTLogPublicKey writes the test CTLog public key to disk and sets the corresponding environment variable to make it available to cosign.

(t *testing.T)

Source from the content-addressed store, hash-verified

107// SetTestCTLogPublicKey writes the test CTLog public key to disk and sets the corresponding
108// environment variable to make it available to cosign.
109func SetTestCTLogPublicKey(t *testing.T) {
110 // Do not use afero.NewMemMapFs() here because the file is read by cosign
111 // which does not understand the filesystem-from-context pattern
112 f, err := os.Create(path.Join(t.TempDir(), "ctlog.pub"))
113 assert.NoError(t, err)
114 defer f.Close()
115 _, err = f.Write([]byte(TestCTLogPublicKey))
116 assert.NoError(t, err)
117 t.Setenv("SIGSTORE_CT_LOG_PUBLIC_KEY_FILE", f.Name())
118}
119
120// TestPublicKey is an arbitrary key created via `cosign generate-key-pair` with no password.
121const TestRekorPublicKey = `-----BEGIN PUBLIC KEY-----

Calls 3

CloseMethod · 0.65
NameMethod · 0.65
WriteMethod · 0.45