From f40dfc6ae07407905b7412698d1ea240a782ad96 Mon Sep 17 00:00:00 2001 From: p4u Date: Mon, 18 Feb 2019 10:48:58 +0100 Subject: [PATCH] CensusService: add `method` field required for signature Signed-off-by: p4u --- cmd/censushttp/README.md | 2 +- service/census/censusmanager.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/censushttp/README.md b/cmd/censushttp/README.md index 6587ae6..a30df86 100644 --- a/cmd/censushttp/README.md +++ b/cmd/censushttp/README.md @@ -43,7 +43,7 @@ The next table shows the available methods and its relation with the fields. ## Signature -The signature provides authentication by signing a concatenation of the following strings (even if empty) without spaces: `censusId rootHash claimData timeStamp`. +The signature provides authentication by signing a concatenation of the following strings (even if empty) without spaces: `method censusId rootHash claimData timeStamp`. The `timeStamp` when received on the server side must not differ more than 10 seconds from the current UNIX time. diff --git a/service/census/censusmanager.go b/service/census/censusmanager.go index 7b926d8..3e3d870 100644 --- a/service/census/censusmanager.go +++ b/service/census/censusmanager.go @@ -118,9 +118,9 @@ func opHandler(c *Claim) *Result { var err error // Process data - log.Printf("censusId:{%s} rootHash:{%s} claimData:{%s} proofData:{%s} timeStamp:{%s} signature:{%s}\n", - c.CensusID, c.RootHash, c.ClaimData, c.ProofData, c.TimeStamp, c.Signature) - authString := fmt.Sprintf("%s%s%s%s", c.CensusID, c.RootHash, c.ClaimData, c.TimeStamp) + log.Printf("censusId:{%s} method:{%s} rootHash:{%s} claimData:{%s} proofData:{%s} timeStamp:{%s} signature:{%s}\n", + c.CensusID, c.Method, c.RootHash, c.ClaimData, c.ProofData, c.TimeStamp, c.Signature) + authString := fmt.Sprintf("%s%s%s%s%s", c.Method, c.CensusID, c.RootHash, c.ClaimData, c.TimeStamp) resp.Error = false resp.Response = "" censusFound := false