Просмотр исходного кода

Add JSON encoder/signing protocol comment

Rod Hynes 6 лет назад
Родитель
Сommit
e930c7bceb
1 измененных файлов с 9 добавлено и 0 удалено
  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)