Beispiel #1
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string deviceBrand, string deviceModel, byte[] randomEncryKey, string imgSID, string code, string imgKey)
        {
            AuthRequest.Builder builder = new AuthRequest.Builder();
            builder.SetBase(br);
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string text = FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            builder.SetPwd(new SKBuiltinString_t.Builder().SetString(text).Build());
            builder.SetImgSid(new SKBuiltinString_t.Builder().SetString(imgSID).Build());
            builder.SetImgCode(new SKBuiltinString_t.Builder().SetString(code).Build());
            builder.SetPwd2(text);
            builder.SetBuiltinIPSeq(0);
            builder.SetExtPwd(text);
            builder.SetExtPwd2(text);
            builder.SetTimeZone("8.00");
            builder.SetLanguage("zh_CN");
            builder.SetIMEI(imei);
            builder.SetChannel(0);
            builder.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString(imgKey).Build());
            builder.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            builder.SetDeviceBrand(deviceBrand);
            builder.SetDeviceModel(deviceModel);
            builder.SetOSType("android-10");
            builder.SetDeviceType("<deviceinfo><MANUFACTURER name=\"unknown\"><MODEL name=\"sdk\"><VERSION_RELEASE name=\"2.3.3\"><VERSION_INCREMENTAL name=\"101070\"><DISPLAY name=\"sdk-eng 2.3.3 GRI34 101070 test-keys\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            builder.SetAuthTicket("");
            builder.SetSignature("e89b158e4bcf988ebd09eb83f5378e87");
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetILen(16);
            builder2.SetBuffer(ByteString.CopyFrom(randomEncryKey));
            SKBuiltinBuffer_t randomEncryKey2 = builder2.Build();

            builder.SetRandomEncryKey(randomEncryKey2);
            return(builder.Build());
        }
Beispiel #2
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string MANUFACTURER, string MODEL, string RELEASE, string INCREMENTAL, string DISPLAY, string OSType, byte[] randomEncryKey)
        {
            AuthRequest.Builder builder = new AuthRequest.Builder();
            builder.SetBase(br);
            builder.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string text = FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            builder.SetPwd(new SKBuiltinString_t.Builder().SetString(text).Build());
            builder.SetImgSid(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetImgCode(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetPwd2(text);
            builder.SetBuiltinIPSeq(0);
            builder.SetExtPwd(text);
            builder.SetExtPwd2(text);
            builder.SetTimeZone("8.00");
            builder.SetLanguage("en_US");
            builder.SetIMEI(imei);
            builder.SetChannel(0);
            builder.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString("").Build());
            builder.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            builder.SetDeviceBrand(MANUFACTURER);
            builder.SetDeviceModel(MODEL);
            builder.SetOSType(OSType);
            builder.SetDeviceType("<deviceinfo><MANUFACTURER name=\"" + MANUFACTURER + "\"><MODEL name=\"" + MODEL + "\"><VERSION_RELEASE name=\"" + RELEASE + "\"><VERSION_INCREMENTAL name=\"" + INCREMENTAL + "\"><DISPLAY name=\"" + DISPLAY + "\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            builder.SetAuthTicket("");
            builder.SetSignature("18c867f0717aa67b2ab7347505ba07ed");
            SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder();
            builder2.SetILen(16);
            builder2.SetBuffer(ByteString.CopyFrom(randomEncryKey));
            SKBuiltinBuffer_t randomEncryKey2 = builder2.Build();

            builder.SetRandomEncryKey(randomEncryKey2);
            return(builder.Build());
        }
        Task <AuthorizationResult> IIPService.DoAuthorization(string login_hint)
        {
            var tcs = new TaskCompletionSource <AuthorizationResult>();

            var service      = new CellularService(context);
            var authCallback = new IPAuthorizationCallback
            {
                OnAuthDidComplete = (response) =>
                {
                    Log.Info("OnAuthDidComplete", "OnAuthDidComplete");
                    Log.Info("OnAuthDidComplete", "code: " + response.Code);
                    //System.Console.WriteLine(response.Code);
                    var AuthResult = new AuthorizationResult();
                    if (response.Code != null)
                    {
                        AuthResult.IsSuccess = true;
                    }
                    else
                    {
                        AuthResult.IsSuccess = false;
                    }
                    AuthResult.Code = response.Code;
                    tcs.SetResult(AuthResult);
                },
                OnAuthDidError = (error) =>
                {
                    //System.Console.WriteLine("OnAuthDidError");
                    Log.Info("OnAuthDidError", "OnAuthDidError " + error.Error_code);
                    var AuthResult = new AuthorizationResult
                    {
                        IsSuccess    = false,
                        ErrorMessage = error.ErrorMessage,
                        ErrorCode    = error.Error_code
                    };
                    tcs.SetResult(AuthResult);
                }
            };
            var authRequestBuilder = new AuthRequest.Builder();

            authRequestBuilder.AddQueryParam("login_hint", login_hint);

            var auth = authRequestBuilder.Build();

            service.PerformAuth(auth, authCallback);

            return(tcs.Task);
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="br"></param>
        /// <param name="wxAccount">用户名</param>
        /// <param name="wxPwd">密码</param>
        /// <param name="imei">串号</param>
        /// <param name="MANUFACTURER">手机名(厂家)</param>
        /// <param name="MODEL">手机型号</param>
        /// <param name="RELEASE">版本号</param>
        /// <param name="INCREMENTAL">增量版本</param>
        /// <param name="DISPLAY">显示名</param>
        /// <param name="OSType">OSType</param>
        /// <param name="randomEncryKey"></param>
        /// <returns></returns>
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string MANUFACTURER, string MODEL, string RELEASE, string INCREMENTAL, string DISPLAY, string OSType, byte[] randomEncryKey)
        {
            AuthRequest.Builder aqb = new AuthRequest.Builder();
            aqb.SetBase(br);
            aqb.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string strWxPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            aqb.SetPwd(new SKBuiltinString_t.Builder().SetString(strWxPwd).Build());
            aqb.SetImgSid(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetImgCode(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetPwd2(strWxPwd);
            aqb.SetBuiltinIPSeq(0);
            aqb.SetExtPwd(strWxPwd);
            aqb.SetExtPwd2(strWxPwd);
            aqb.SetTimeZone("8.00");
            aqb.SetLanguage("en_US");
            aqb.SetIMEI(imei);
            aqb.SetChannel(0);
            aqb.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString("").Build());
            aqb.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            aqb.SetDeviceBrand(MANUFACTURER);
            aqb.SetDeviceModel(MODEL);
            aqb.SetOSType(OSType);
            aqb.SetDeviceType("<deviceinfo><MANUFACTURER name=\"" + MANUFACTURER + "\"><MODEL name=\"" + MODEL + "\"><VERSION_RELEASE name=\""
                              + RELEASE + "\"><VERSION_INCREMENTAL name=\"" + INCREMENTAL + "\"><DISPLAY name=\""
                              + DISPLAY + "\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            aqb.SetAuthTicket("");
            //auth.set_signature("18c867f0717aa67b2ab7347505ba07ed");//18c867f0717aa67b2ab7347505ba07ed 正式版 e89b158e4bcf988ebd09eb83f5378e87 修改版
            aqb.SetSignature("18c867f0717aa67b2ab7347505ba07ed");
            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetILen(16);
            //byte[] randomKey = new byte[] { 0x8e, 0x61, 0x93, 0x89, 0xe8, 0x99, 0x42, 0x1d, 0x07, 0x74, 0xF0, 0x09, 0x36, 0x5e, 0x4b, 0x1f };
            //byte[] randomKey = new byte[16];
            skbb.SetBuffer(ByteString.CopyFrom(randomEncryKey));//("\x8e\x61\x93\x89\xe8\x99\x42\x1d\x07\x74\xF0\x09\x36\x5e\x4b\x1f",Encoding.Default));
            SKBuiltinBuffer_t sbk = skbb.Build();

            aqb.SetRandomEncryKey(sbk);

            AuthRequest ar = aqb.Build();

            return(ar);
        }
Beispiel #5
0
        public static AuthRequest CreateAuthRequestEntity(BaseRequest br, string wxAccount, string wxPwd, string imei, string deviceBrand, string deviceModel, byte[] randomEncryKey, string imgSID, string code, string imgKey)
        {
            AuthRequest.Builder aqb = new AuthRequest.Builder();
            aqb.SetBase(br);
            aqb.SetUserName(new SKBuiltinString_t.Builder().SetString(wxAccount).Build());
            string strWxPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(wxPwd, "MD5");

            aqb.SetPwd(new SKBuiltinString_t.Builder().SetString(strWxPwd).Build());
            aqb.SetImgSid(new SKBuiltinString_t.Builder().SetString(imgSID).Build());
            aqb.SetImgCode(new SKBuiltinString_t.Builder().SetString(code).Build());
            aqb.SetPwd2(strWxPwd);
            aqb.SetBuiltinIPSeq(0);
            aqb.SetExtPwd(strWxPwd);
            aqb.SetExtPwd2(strWxPwd);
            aqb.SetTimeZone("8.00");
            aqb.SetLanguage("zh_CN");
            aqb.SetIMEI(imei);
            aqb.SetChannel(0);
            aqb.SetImgEncryptKey(new SKBuiltinString_t.Builder().SetString(imgKey).Build());
            aqb.SetKSid(new SKBuiltinBuffer_t.Builder().SetILen(0).SetBuffer(ByteString.CopyFrom("", Encoding.Default)));
            aqb.SetDeviceBrand(deviceBrand);
            aqb.SetDeviceModel(deviceModel);
            aqb.SetOSType("android-10");
            aqb.SetDeviceType("<deviceinfo><MANUFACTURER name=\"unknown\"><MODEL name=\"sdk\"><VERSION_RELEASE name=\"2.3.3\"><VERSION_INCREMENTAL name=\"101070\"><DISPLAY name=\"sdk-eng 2.3.3 GRI34 101070 test-keys\"></DISPLAY></VERSION_INCREMENTAL></VERSION_RELEASE></MODEL></MANUFACTURER></deviceinfo>");
            aqb.SetAuthTicket("");
            aqb.SetSignature("e89b158e4bcf988ebd09eb83f5378e87");
            SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder();
            skbb.SetILen(16);
            //byte[] randomKey = new byte[] { 0x8e, 0x61, 0x93, 0x89, 0xe8, 0x99, 0x42, 0x1d, 0x07, 0x74, 0xF0, 0x09, 0x36, 0x5e, 0x4b, 0x1f };
            //byte[] randomKey = new byte[16];
            skbb.SetBuffer(ByteString.CopyFrom(randomEncryKey));//("\x8e\x61\x93\x89\xe8\x99\x42\x1d\x07\x74\xF0\x09\x36\x5e\x4b\x1f",Encoding.Default));
            SKBuiltinBuffer_t sbk = skbb.Build();

            aqb.SetRandomEncryKey(sbk);

            AuthRequest ar = aqb.Build();

            return(ar);
        }