aboutsummaryrefslogtreecommitdiff
path: root/instance_test.go
blob: 51f7a358a67c78e00f7c9aa82021bc6889b29291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package stfe

import (
	"testing"

	"crypto"
	"crypto/x509"

	"github.com/system-transparency/stfe/testdata"
	"github.com/system-transparency/stfe/x509util"
)

func makeTestLogParameters(t *testing.T, signer crypto.Signer) *LogParameters {
	anchorList, err := x509util.NewCertificateList(testdata.PemAnchors)
	if err != nil {
		t.Fatalf("must decode trust anchors: %v", err)
	}
	if got, want := len(anchorList), testdata.NumPemAnchors; got != want {
		t.Fatalf("must have %d trust anchor(s), got %d", want, got)
	}
	return &LogParameters{
		LogId:      make([]byte, 32),
		TreeId:     0,
		Prefix:     "/test",
		MaxRange:   3,
		MaxChain:   3,
		AnchorPool: x509util.NewCertPool(anchorList),
		AnchorList: anchorList,
		KeyUsage:   []x509.ExtKeyUsage{x509.ExtKeyUsageAny},
		Signer:     signer,
		HashType:   crypto.SHA256,
	}
}