From 4cf5bc1b5f954646e006c7e491c4b20657409567 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 13 六月 2023 13:30:30 +0800 Subject: [PATCH] 本地加密秘钥写入 --- Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs | 3 - Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/Production.p12 | 0 Crabtree/ON.Ios/Info.plist | 4 +- Crabtree/SmartHome/HDL/Common/HttpUtil/ErrorCode.cs | 2 Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs | 6 +- Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/CrabtreeSmartH_Prod.mobileprovision | 0 Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs | 6 ++- Crabtree/ON/Properties/AndroidManifest.xml | 4 +- Crabtree/ON/ON.Droid.csproj | 2 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs | 71 +++++++++++++++++++++++++++++++++++ Crabtree/ON.Ios/ON.Ios.csproj | 2 Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 2 12 files changed, 87 insertions(+), 15 deletions(-) diff --git a/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/CrabtreeSmartH_Prod.mobileprovision b/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/CrabtreeSmartH_Prod.mobileprovision new file mode 100644 index 0000000..58b1b1c --- /dev/null +++ b/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/CrabtreeSmartH_Prod.mobileprovision Binary files differ diff --git a/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/Production.p12 b/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/Production.p12 new file mode 100644 index 0000000..1b82107 --- /dev/null +++ b/Crabtree/CrabtreeOnCertificates:ProvisioningProfile/2023/adhoc/Production.p12 Binary files differ diff --git a/Crabtree/ON.Ios/Info.plist b/Crabtree/ON.Ios/Info.plist index 9d6fa38..41acfb4 100755 --- a/Crabtree/ON.Ios/Info.plist +++ b/Crabtree/ON.Ios/Info.plist @@ -17,9 +17,9 @@ <key>CFBundleIdentifier</key> <string>com.hdl.crabtreenew</string> <key>CFBundleShortVersionString</key> - <string>2.701111</string> + <string>2.800526</string> <key>CFBundleVersion</key> - <string>2.701111</string> + <string>2.800526</string> <key>LSRequiresIPhoneOS</key> <true/> <key>MinimumOSVersion</key> diff --git a/Crabtree/ON.Ios/ON.Ios.csproj b/Crabtree/ON.Ios/ON.Ios.csproj index 8c1e7e2..3c447e5 100644 --- a/Crabtree/ON.Ios/ON.Ios.csproj +++ b/Crabtree/ON.Ios/ON.Ios.csproj @@ -37,7 +37,7 @@ <DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;HDL;HDLVideo;</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> - <CodesignKey>iPhone Distribution: Havells India Limited (6FQDUKMB48)</CodesignKey> + <CodesignKey>Apple Distribution: Havells India Limited (6FQDUKMB48)</CodesignKey> <MtouchFloat32>true</MtouchFloat32> <MtouchLink>SdkOnly</MtouchLink> <MtouchArch>ARM64</MtouchArch> diff --git a/Crabtree/ON/ON.Droid.csproj b/Crabtree/ON/ON.Droid.csproj index a88555b..84d6771 100644 --- a/Crabtree/ON/ON.Droid.csproj +++ b/Crabtree/ON/ON.Droid.csproj @@ -52,7 +52,7 @@ <NoWarn></NoWarn> <AndroidDexTool>d8</AndroidDexTool> <AndroidSupportedAbis>armeabi-v7a;arm64-v8a</AndroidSupportedAbis> -<AndroidPackageFormat>apk</AndroidPackageFormat> +<AndroidPackageFormat>aab</AndroidPackageFormat> </PropertyGroup> <ItemGroup> <Reference Include="System" /> diff --git a/Crabtree/ON/Properties/AndroidManifest.xml b/Crabtree/ON/Properties/AndroidManifest.xml index 51a5ea2..70bda1c 100644 --- a/Crabtree/ON/Properties/AndroidManifest.xml +++ b/Crabtree/ON/Properties/AndroidManifest.xml @@ -1,6 +1,6 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.804131" android:versionCode="202304131"> - <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" /> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.806101" android:versionCode="202306101"> + <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> <!-- 鍦ㄥ畨鍗揚鐗堟湰涔嬪悗锛屽繀椤昏鎺堜簣FOREGROUND_SERVICE鏉冮檺锛屾墠鑳藉浣跨敤鍓嶅彴鏈嶅姟 --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- 瀹氫綅鏉冮檺锛岀敤浜嶢PP閫氳繃鑾峰彇瀹氫綅鍧愭爣鏌ヨ褰撳墠鍦板尯澶╂皵--> diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/ErrorCode.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/ErrorCode.cs index cfe950a..4eb87b8 100644 --- a/Crabtree/SmartHome/HDL/Common/HttpUtil/ErrorCode.cs +++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/ErrorCode.cs @@ -93,6 +93,6 @@ //澶囨敞涓嶈兘涓虹┖銆� public readonly static string RemarksCannotBeEmpty = "Device name cannot be empty"; //璇锋眰鏈嶅姟鍣ㄥけ璐ワ紝璇风◢鍚庡啀璇曪紒 - public readonly static string FailedRequestServer = "Failed to request the server, please try again later!"; + public readonly static string FailedRequestServer = "Failed to request the server, please try again later!";//Request exception, please return and try again } } diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs index 24a5b9f..d161113 100644 --- a/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs +++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs @@ -193,9 +193,9 @@ /// 鑾峰彇缃戝叧淇℃伅 /// </summary> public const string Api_Post_GetGatewayInfo = "/home-wisdom/app/gateway/info"; - ///// <summary> - ///// 瑙g粦缁戠綉鍏冲埌浣忓畢 - ///// </summary> + /// <summary> + /// 瑙g粦浣忓畢缃戝叧 + /// </summary> public const string API_POST_UntieGateway = "/home-wisdom/app/gateway/untieGateway"; /// <summary> /// 寮哄埗鎹㈢粦缃戝叧 diff --git a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs index d32f70e..b872171 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs @@ -106,9 +106,8 @@ //MainPage.AddTip (Language.StringByID (R.MyInternationalizationString.SearchingGatewayLocally)); MainPage.LoadingStart (Language.StringByID (R.MyInternationalizationString.SearchingGatewayLocally)); - var control = new Control (); - UserConfig.Instance.IsLocalEncrypt = false; + var control = new Control (); control.Send (new Target () { IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), Command = Command.ReadGateway, diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index 6e45238..3f01c6c 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -38,7 +38,7 @@ //public static Button LogoButton = new Button (); - public static string RequestVersion = "2.804131"; + public static string RequestVersion = "2.805291"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs index f1ff0a4..138dc05 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs @@ -412,7 +412,8 @@ UserConfig.Instance.SaveUserConfig (); return true; } - } else if (revertObj.Code == "147103") { + } + else if (revertObj.Code == "147103") { var pack = HttpServerRequest.Current.UnBindGateway (bindGatewayObj.homeId, UserConfig.Instance.HomeGateway.gatewayId); if (pack.Code == StateCode.SUCCESS) { var homeGatewayInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo> (revertObj.Data.ToString ()); @@ -429,7 +430,8 @@ } else { IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); } - } else { + } + else { IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); } } catch { diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs index 1f481e5..a6bc6ef 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs @@ -170,6 +170,77 @@ }; contentView.AddChidren (btnModifyNullLine); #endregion + + + #region LocalEncryption + var LocalEncryptionView = new FrameLayout () { + Height = Application.GetRealHeight (100), + }; + contentView.AddChidren (LocalEncryptionView); + + Button btnLocalEncryptionTitle = new Button () { + X = Application.GetRealWidth (40), + Text = "Set local encryption", + TextAlignment = TextAlignment.CenterLeft, + TextColor = SkinStyle.Current.TextColor1, + }; + LocalEncryptionView.AddChidren (btnLocalEncryptionTitle); + + Button btnLocalEncryptionRight = new Button () { + X = Application.GetRealWidth (580), + Width = Application.GetRealWidth (28), + Height = Application.GetRealHeight (40), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = "Item/Right.png", + SelectedImagePath = "Item/RightSelected.png", + }; + LocalEncryptionView.AddChidren (btnLocalEncryptionRight); + + EventHandler<MouseEventArgs> localEncryptionHandler = (sender, e) => { + + var waitPage = new Loading (); + this.AddChidren (waitPage); + waitPage.Start ("wait..."); + new System.Threading.Thread (() => { + try { + byte [] AseKeyBytes = UserConfig.Instance.GenerateLocalEncryptionKey (); + byte [] sendBytes = new byte [17]; + sendBytes [0] = (byte)1; //0:涓嶅姞瀵� 1:鍔犲瘑 + Array.Copy (AseKeyBytes, 0, sendBytes, 1, 16); + + UserConfig.Instance.IsLocalEncrypt = false; + var control = new Control (); + control.Send (new Target () { + IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), + Command = Command.SetGateWayLocalEncryption, + SubnetID = 255, + DeviceID = 0, + AddData = sendBytes + }, SendCount.Three, true, true); + var backBytes = control.UsefulBytes; + }catch(Exception ex) { + + } finally { + Application.RunOnMainThread (() => { + waitPage.Hide (); + }); + } + }) { IsBackground = true }.Start (); + }; + LocalEncryptionView.MouseUpEventHandler += localEncryptionHandler; + btnLocalEncryptionTitle.MouseUpEventHandler += localEncryptionHandler; + btnModifyPasswordRight.MouseUpEventHandler += localEncryptionHandler; + + Button btnLocalEncryptionLine = new Button () { + Height = Application.GetRealHeight (5), + BackgroundColor = SkinStyle.Current.MainColor, + }; + contentView.AddChidren (btnLocalEncryptionLine); + #endregion + + + + Button btnLogout = new Button () { Y = contentView.Bottom, Height = Application.GetRealHeight (93), -- Gitblit v1.8.0