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

Clearer error message for missing public key case

Rod Hynes 6 лет назад
Родитель
Сommit
536e7e3d7a
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      psiphon/common/protocol/serverEntry.go

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

@@ -332,6 +332,10 @@ func (fields ServerEntryFields) AddSignature(publicKey, privateKey string) error
 // imported from an untrusted source, such as client-to-client exchange.
 func (fields ServerEntryFields) VerifySignature(publicKey string) error {
 
+	if publicKey == "" {
+		return common.ContextError(errors.New("missing public key"))
+	}
+
 	// Make a copy so that removing unsigned fields will have no side effects
 	copyFields := make(ServerEntryFields)
 	for k, v := range fields {