From 8edf8fd9f5f7c29cc6302a8d46de06d391ed3657 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期四, 16 一月 2020 13:03:57 +0800 Subject: [PATCH] 2020-01-16 Version 2.50115-B3 1.优化MQTT连接。 2.增加本地通信加密。 3.增加配置网关提示语。 4.编辑定时器增加重复名字提示 5.更新规范翻译。 --- Crabtree/SmartHome/HDL/Operation/UserConfig.cs | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/UserConfig.cs b/Crabtree/SmartHome/HDL/Operation/UserConfig.cs index 93db11b..0a8f065 100644 --- a/Crabtree/SmartHome/HDL/Operation/UserConfig.cs +++ b/Crabtree/SmartHome/HDL/Operation/UserConfig.cs @@ -154,6 +154,10 @@ set { currentRegion = value; CheckIfNeedGetMasterAccountToken (); + //鍒囨崲浣忓畢 璁剧疆鏈湴鍔犲瘑Key + SetLocalEncryptKey (); + + } get { if (currentRegion == null) { @@ -256,6 +260,54 @@ public List<string> RometoUserInfoKeys = new List<string> (); + + /// <summary> + /// 鏈湴閫氫俊鍔犲瘑Key + /// </summary> + public string LocalEncryptKey = string.Empty; + + + /// <summary> + /// 鏄惁鍔犲瘑瀵嗙爜楠岃瘉閫氳繃 + /// </summary> + public bool EncryptedPasswordCorrect = true; + + /// <summary> + /// 鏄惁鍔犲瘑 + /// </summary> + public bool IsLocalEncrypt = false; + /// <summary> + /// 璁剧疆涓洪粯璁ゅ姞瀵嗭紝骞惰绠楀姞瀵咾ey + /// </summary> + private void SetLocalEncryptKey () + { + if (currentRegion != null) { + IsLocalEncrypt = true; + GenerateLocalEncryptionKey (); + //LocalEncryptKey = CommonPage.MyEncodingUTF8.GetString (GenerateLocalEncryptionKey ()); + } + } + + /// <summary> + /// 鑾峰彇16浣嶇殑key byte [] + /// </summary> + /// <returns></returns> + public byte [] GenerateLocalEncryptionKey () + { + byte [] aseKey = new byte [16]; + try { + //鐢熸垚鍔犲瘑Key + byte [] homeId = System.Text.Encoding.ASCII.GetBytes (currentRegion.Id); + Array.Copy (homeId, 0, aseKey, 0, 16 < homeId.Length ? 16 : homeId.Length); + LocalEncryptKey = System.Text.Encoding.ASCII.GetString (aseKey); + return aseKey; + + } catch { + return aseKey; + } + + } + public string MasterAccountToken = ""; public string MasterAccountRequestBaseUrl = ""; /// <summary> -- Gitblit v1.8.0