| | |
| | | set { |
| | | currentRegion = value; |
| | | CheckIfNeedGetMasterAccountToken (); |
| | | //切换住宅 设置本地加密Key |
| | | SetLocalEncryptKey (); |
| | | |
| | | |
| | | } |
| | | get { |
| | | if (currentRegion == null) { |
| | |
| | | |
| | | public List<string> RometoUserInfoKeys = new List<string> (); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 本地通信加密Key |
| | | /// </summary> |
| | | public string LocalEncryptKey = string.Empty; |
| | | |
| | | /// <summary> |
| | | /// 是否加密 |
| | | /// </summary> |
| | | public bool IsLocalEncrypt = false; |
| | | /// <summary> |
| | | /// 设置为默认加密,并计算加密Key |
| | | /// </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> |