aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-23 21:36:00 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-23 21:36:00 +0100
commitb2e10535ef094e8bc9995769c2a22a1ee29cbe57 (patch)
treeadce4aaef9978a04e09d24499f99752c6d2dbf8c /server
parent15444f91e74de6e1ca8ea99511e8cb6dcd92fa91 (diff)
added start on isolated trillian checks
Diffstat (limited to 'server')
-rw-r--r--server/testdata/data.go46
-rw-r--r--server/testdata/helper.go47
-rw-r--r--server/testdata/type.go32
3 files changed, 0 insertions, 125 deletions
diff --git a/server/testdata/data.go b/server/testdata/data.go
deleted file mode 100644
index 3c814d9..0000000
--- a/server/testdata/data.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package testdata
-
-var (
- // PemAnchors is a list of trusted root certificates
- PemAnchors = []byte(`-----BEGIN CERTIFICATE-----
-MIIB/TCCAa+gAwIBAgIUDYJzaC5VSkKwiLVAxO5MyphAkN8wBQYDK2VwMGwxCzAJ
-BgNVBAYTAk5BMQswCQYDVQQIDAJOQTELMAkGA1UEBwwCTkExCzAJBgNVBAoMAk5B
-MQswCQYDVQQLDAJOQTEWMBQGA1UEAwwNc3RmZSB0ZXN0ZGF0YTERMA8GCSqGSIb3
-DQEJARYCTkEwHhcNMjAxMTAzMTgzMTMxWhcNMzIwMTIxMTgzMTMxWjBsMQswCQYD
-VQQGEwJOQTELMAkGA1UECAwCTkExCzAJBgNVBAcMAk5BMQswCQYDVQQKDAJOQTEL
-MAkGA1UECwwCTkExFjAUBgNVBAMMDXN0ZmUgdGVzdGRhdGExETAPBgkqhkiG9w0B
-CQEWAk5BMCowBQYDK2VwAyEAJ1IiXCB4YHwdWka9MM0bc7LvKAtksmtIo8IhkuEB
-uzGjYzBhMB0GA1UdDgQWBBQBvsxROtKU6zmr/SxcfTMDsAQcMTAfBgNVHSMEGDAW
-gBQBvsxROtKU6zmr/SxcfTMDsAQcMTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
-/wQEAwIChDAFBgMrZXADQQCXh6kDnE5giTjcLET2S94qTwnHVAj57DJcR/rf9Jy8
-NMGbtzTL0/V0B8DHuJFA/islbZJbN7rSvqddEKL8N2gI
------END CERTIFICATE-----`)
- // PemChain is composed of an end-entity and intermediate certificate
- PemChain = []byte(`-----BEGIN CERTIFICATE-----
-MIIBbDCCAR4CFDfeuu6XURfn7AE4WShuwZBHEaLIMAUGAytlcDBsMQswCQYDVQQG
-EwJOQTELMAkGA1UECAwCTkExCzAJBgNVBAcMAk5BMQswCQYDVQQKDAJOQTELMAkG
-A1UECwwCTkExFjAUBgNVBAMMDXN0ZmUgdGVzdGRhdGExETAPBgkqhkiG9w0BCQEW
-Ak5BMB4XDTIwMTEwMzE4MzI0MFoXDTMyMDEyMTE4MzI0MFowRTELMAkGA1UEBhMC
-QVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdp
-dHMgUHR5IEx0ZDAqMAUGAytlcAMhAJvk390ZvwULplBri03Od4LLz+Sf/OUHu+20
-wik+T9y5MAUGAytlcANBANekliXq4ttoClBJDZoktIQxyHHNcWyXFrj1HlOaT5bC
-I3GIqqZ60Ua3jKytnEsKsD2rLMPItDwmG6wYSecy2ws=
------END CERTIFICATE-----
------BEGIN CERTIFICATE-----
-MIIB7jCCAaCgAwIBAgICEAAwBQYDK2VwMGwxCzAJBgNVBAYTAk5BMQswCQYDVQQI
-DAJOQTELMAkGA1UEBwwCTkExCzAJBgNVBAoMAk5BMQswCQYDVQQLDAJOQTEWMBQG
-A1UEAwwNc3RmZSB0ZXN0ZGF0YTERMA8GCSqGSIb3DQEJARYCTkEwHhcNMjAxMTAz
-MTgzMjE4WhcNMzIwMTIxMTgzMjE4WjBsMQswCQYDVQQGEwJOQTELMAkGA1UECAwC
-TkExCzAJBgNVBAcMAk5BMQswCQYDVQQKDAJOQTELMAkGA1UECwwCTkExFjAUBgNV
-BAMMDXN0ZmUgdGVzdGRhdGExETAPBgkqhkiG9w0BCQEWAk5BMCowBQYDK2VwAyEA
-F1yPPpjHKDAKN73pBFGXzAvIjdkLLimydu2y1HLMOiKjZjBkMB0GA1UdDgQWBBQ6
-P7JQ7yXtrTh7YkVU0I78P9A+nDAfBgNVHSMEGDAWgBQBvsxROtKU6zmr/SxcfTMD
-sAQcMTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIChDAFBgMrZXAD
-QQBm1GMV0ADPnXRWnelCW9tcyTh0p9hKefuSy/MNx7/XLHKnM5fX+yHqD84QOxES
-Vc510vi4dM8I+e/vcoBsmMQP
------END CERTIFICATE-----`)
- // PemChainKey is the private key of the final certificate in PemChain
- PemChainKey = []byte(`-----BEGIN PRIVATE KEY-----
-MC4CAQAwBQYDK2VwBCIEIDme3WaCwW2/FX095yh02yIIsn0D3vbvN5NsJzcdUwq1
------END PRIVATE KEY-----`)
-)
diff --git a/server/testdata/helper.go b/server/testdata/helper.go
deleted file mode 100644
index 6874616..0000000
--- a/server/testdata/helper.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package testdata
-
-import (
- "testing"
-
- "github.com/google/trillian"
- "github.com/google/trillian/types"
-)
-
-// NewGetLatestSignedLogRootResponse creates a new trillian STH. Revision,
-// Metadata, Proof, KeyHint, and LogRootSignature are unsset.
-func NewGetLatestSignedLogRootResponse(t *testing.T, timestamp, size uint64, hash []byte) *trillian.GetLatestSignedLogRootResponse {
- t.Helper()
- return &trillian.GetLatestSignedLogRootResponse{
- SignedLogRoot: marshalSignedLogRoot(t, &types.LogRootV1{
- TreeSize: size,
- RootHash: hash,
- TimestampNanos: timestamp,
- Revision: 0, // not used by stfe
- Metadata: nil, // not used by stfe
- }),
- Proof: nil, // not used by stfe
- }
-}
-
-// TruncatedSignedLogRootResponse creates a truncated signed log root response
-// that cannot be unmarshalled, i.e., SignedLogRoot.LogRoot is invalid.
-func TruncatedSignedLogRootResponse(t *testing.T) *trillian.GetLatestSignedLogRootResponse {
- t.Helper()
- slrr := NewGetLatestSignedLogRootResponse(t, 0, 0, make([]byte, 32))
- slrr.SignedLogRoot.LogRoot = slrr.SignedLogRoot.LogRoot[1:]
- return slrr
-}
-
-// marshalSignedLogRoot must marshal a signed log root
-func marshalSignedLogRoot(t *testing.T, lr *types.LogRootV1) *trillian.SignedLogRoot {
- t.Helper()
- rootBytes, err := lr.MarshalBinary()
- if err != nil {
- t.Fatalf("failed to marshal root in test: %v", err)
- }
- return &trillian.SignedLogRoot{
- KeyHint: nil, // not used by stfe
- LogRoot: rootBytes,
- LogRootSignature: nil, // not used by stfe
- }
-}
diff --git a/server/testdata/type.go b/server/testdata/type.go
deleted file mode 100644
index 93041c9..0000000
--- a/server/testdata/type.go
+++ /dev/null
@@ -1,32 +0,0 @@
-package testdata
-
-import (
- "context"
- "fmt"
-
- "github.com/golang/mock/gomock"
-)
-
-// DeadlineMatcher implements gomock.Matcher, such that an error is raised if
-// there is no context.Context deadline set
-type DeadlineMatcher struct{}
-
-// NewDeadlineMatcher returns a new DeadlineMatcher
-func NewDeadlineMatcher() gomock.Matcher {
- return &DeadlineMatcher{}
-}
-
-// Matches returns true if the passed interface is a context with a deadline
-func (dm *DeadlineMatcher) Matches(i interface{}) bool {
- ctx, ok := i.(context.Context)
- if !ok {
- return false
- }
- _, ok = ctx.Deadline()
- return ok
-}
-
-// String is needed to implement gomock.Matcher
-func (dm *DeadlineMatcher) String() string {
- return fmt.Sprintf("deadlineMatcher{}")
-}