SetTestCTLogPublicKey writes the test CTLog public key to disk and sets the corresponding environment variable to make it available to cosign.
(t *testing.T)
| 107 | // SetTestCTLogPublicKey writes the test CTLog public key to disk and sets the corresponding |
| 108 | // environment variable to make it available to cosign. |
| 109 | func 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. |
| 121 | const TestRekorPublicKey = `-----BEGIN PUBLIC KEY----- |