(t *testing.T)
| 77 | const pubkeyEd25519 = `5TPcCxzVByMyRsMFs5Dx23pnxKilI+1UrGg0t+O2oZU=` |
| 78 | |
| 79 | func TestKeyLoad_existing_pkcs8(t *testing.T) { |
| 80 | m := Modifier{} |
| 81 | m.log = testutils.Logger(t, m.Name()) |
| 82 | |
| 83 | dir := t.TempDir() |
| 84 | |
| 85 | if err := os.WriteFile(filepath.Join(dir, "testkey.key"), []byte(pkeyEd25519), 0o600); err != nil { |
| 86 | t.Fatal(err) |
| 87 | } |
| 88 | |
| 89 | signer, newKey, err := m.loadOrGenerateKey(filepath.Join(dir, "testkey.key"), "ed25519") |
| 90 | if err != nil { |
| 91 | t.Fatal(err) |
| 92 | } |
| 93 | if newKey { |
| 94 | t.Fatal("newKey = true") |
| 95 | } |
| 96 | |
| 97 | blob := signer.Public().(ed25519.PublicKey) |
| 98 | if signerKey := base64.StdEncoding.EncodeToString(blob); signerKey != pubkeyEd25519 { |
| 99 | t.Fatalf("wrong public key returned by loadOrGenerateKey, \nwant %s\ngot %s", pubkeyEd25519, signerKey) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | const pkeyRSA = `-----BEGIN RSA PRIVATE KEY----- |
| 104 | MIIEowIBAAKCAQEAuxWwDR9ADiuV2b9xF+btOIgwS5W0yJeS/Dht4HlUELrye2JZ |
nothing calls this directly
no test coverage detected