diff options
Diffstat (limited to 'http-server/cryptography.go')
| -rw-r--r-- | http-server/cryptography.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/http-server/cryptography.go b/http-server/cryptography.go index 3340446..beaba71 100644 --- a/http-server/cryptography.go +++ b/http-server/cryptography.go @@ -6,7 +6,6 @@ import ( "crypto/sha256" "crypto/x509" "encoding/base64" - "encoding/json" "encoding/pem" "errors" "fmt" @@ -30,10 +29,8 @@ func decodeMessage(ciphertext []byte, stringKey string) ([]byte, error) { return plaintext, err } -func checkSignature(req Request, signature string, key string) (bool, error) { - reqBytes, _ := json.Marshal(req) - req64 := base64.StdEncoding.EncodeToString(reqBytes) - h := sha256.Sum256([]byte(req64)) +func checkSignature(payload string, signature string, key string) (bool, error) { + h := sha256.Sum256([]byte(payload)) requestHash := fmt.Sprintf("%x", h) decodedSign, err := base64.StdEncoding.DecodeString(signature) |