Jelajahi Sumber

Tapdance: use decoy spec public key when available

- Temporary vendor patch.
Rod Hynes 6 tahun lalu
induk
melakukan
5c9ed3f2f1

+ 11 - 1
vendor/github.com/sergeyfrolov/gotapdance/tapdance/conn_raw.go

@@ -388,8 +388,18 @@ func (tdRaw *tdRawConn) prepareTDRequest(handshakeType tdTagType) (string, error
 	}
 	}
 	Logger().Debugln(tdRaw.idStr()+" Initial protobuf", initProto)
 	Logger().Debugln(tdRaw.idStr()+" Initial protobuf", initProto)
 
 
+	// [Psiphon]
+	// Use decoy spec public key if available; otherwise, default public key.
+	var pubkey []byte
+	if tdRaw.decoySpec.Pubkey != nil {
+		pubkey = tdRaw.decoySpec.Pubkey.GetKey()
+	}
+	if len(pubkey) == 0 {
+		pubkey = tdRaw.stationPubkey
+	}
+
 	// Obfuscate/encrypt tag and protobuf
 	// Obfuscate/encrypt tag and protobuf
-	tag, encryptedProtoMsg, err := obfuscateTagAndProtobuf(buf.Bytes(), initProtoBytes, tdRaw.stationPubkey)
+	tag, encryptedProtoMsg, err := obfuscateTagAndProtobuf(buf.Bytes(), initProtoBytes, pubkey)
 	if err != nil {
 	if err != nil {
 		return "", err
 		return "", err
 	}
 	}