Ver Fonte

Add JSON encoder/signing protocol comment

Rod Hynes há 6 anos atrás
pai
commit
e930c7bceb
1 ficheiros alterados com 9 adições e 0 exclusões
  1. 9 0
      psiphon/common/protocol/serverEntry.go

+ 9 - 0
psiphon/common/protocol/serverEntry.go

@@ -291,6 +291,15 @@ func (fields ServerEntryFields) AddSignature(publicKey, privateKey string) error
 
 	delete(copyFields, "signature")
 
+	// Limitation: since the verifyier must remarshal its server entry before
+	// verifying, the JSON produced there must be a byte-for-byte match to the
+	// JSON signed here. The precise output of the JSON encoder that is used,
+	// "encoding/json", with default formatting, as of Go 1.11.5, is therefore
+	// part of the signature protocol.
+	//
+	// TODO: use a stadard, canonical encoding, such as JCS:
+	// https://tools.ietf.org/id/draft-rundgren-json-canonicalization-scheme-05.html
+
 	marshaledFields, err := json.Marshal(copyFields)
 	if err != nil {
 		return common.ContextError(err)