aboutsummaryrefslogtreecommitdiff
path: root/client/verify.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-16 00:26:07 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2021-03-16 00:26:07 +0100
commit9f7690327f8d74abdd86232546a154ab8408d174 (patch)
tree0abeaade1c7673579c1b6a76cd4c6c25395555ee /client/verify.go
parente2959d506de6067afe494315c3621b33613b5414 (diff)
started to re-add basic client commands
Diffstat (limited to 'client/verify.go')
-rw-r--r--client/verify.go39
1 files changed, 0 insertions, 39 deletions
diff --git a/client/verify.go b/client/verify.go
deleted file mode 100644
index 3ce02e7..0000000
--- a/client/verify.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package client
-
-import (
- "github.com/google/trillian/merkle"
- "github.com/google/trillian/merkle/rfc6962"
- "github.com/system-transparency/stfe"
-)
-
-// VerifyConsistencyProofV1 verifies that a consistency proof is valid without
-// checking any sth signature
-func VerifyConsistencyProofV1(proof, first, second *stfe.StItem) error {
- path := make([][]byte, 0, len(proof.ConsistencyProofV1.ConsistencyPath))
- for _, nh := range proof.ConsistencyProofV1.ConsistencyPath {
- path = append(path, nh.Data)
- }
- return merkle.NewLogVerifier(rfc6962.DefaultHasher).VerifyConsistencyProof(
- int64(proof.ConsistencyProofV1.TreeSize1),
- int64(proof.ConsistencyProofV1.TreeSize2),
- first.SignedTreeHeadV1.TreeHead.RootHash.Data,
- second.SignedTreeHeadV1.TreeHead.RootHash.Data,
- path,
- )
-}
-
-// VerifyInclusionProofV1 verifies that an inclusion proof is valid without checking
-// any sth signature
-func VerifyInclusionProofV1(proof *stfe.StItem, rootHash, leafHash []byte) error {
- path := make([][]byte, 0, len(proof.InclusionProofV1.InclusionPath))
- for _, nh := range proof.InclusionProofV1.InclusionPath {
- path = append(path, nh.Data)
- }
- return merkle.NewLogVerifier(rfc6962.DefaultHasher).VerifyInclusionProof(
- int64(proof.InclusionProofV1.LeafIndex),
- int64(proof.InclusionProofV1.TreeSize),
- path,
- rootHash,
- leafHash,
- )
-}