/// <summary> /// 解析请求码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { string FeedbackCode = this.richTextBox1.Text.ToString().Trim(); if (FeedbackCode.Trim().Equals(string.Empty) || FeedbackCode.Length == 0) { MessageBox.Show("无反馈码,请填写反馈码!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); return; } JavaScriptSerializer js = new JavaScriptSerializer(); string strAesDecode = AesClass.AesDecrypt(FeedbackCode); string strRSADecode = RsaDecrypt(strAesDecode); string strBase32Decode = DecodeBase32(strRSADecode); string str = GetLastStr(strBase32Decode, 1); if (str != "}") { strBase32Decode = RemoveLastChar(strBase32Decode, ",\"Info\":"); strBase32Decode += ",\"Info\":0}"; } JsonParser.JsonRegister jsonRegister = js.Deserialize <JsonParser.JsonRegister>(strBase32Decode); string jsonRegister_I = DecodeBase32(jsonRegister.I.ToString().Trim()); string jsonRegister_R = DecodeBase32(jsonRegister.R.ToString().Trim()); string jsonRegister_M = DecodeBase32(jsonRegister.M.ToString().Trim()); string jsonRegister_N = DecodeBase32(jsonRegister.N.ToString().Trim()); string jsonRegister_T = DecodeBase32(jsonRegister.T.ToString().Trim()); var buff = Convert.FromBase64String(jsonRegister_N); string str2 = System.Text.Encoding.Unicode.GetString(buff); jsonRegister.I = jsonRegister_I; jsonRegister.R = jsonRegister_R; jsonRegister.M = jsonRegister_M; jsonRegister.N = str2; // jsonRegister_N; jsonRegister.T = jsonRegister_T; this.richTextBox3.Text = ConvertJsonString(js.Serialize(jsonRegister)); }
/// <summary> /// 解析激活码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { string FeedbackCode = this.richTextBox2.Text.ToString().Trim(); if (FeedbackCode.Trim().Equals(string.Empty) || FeedbackCode.Length == 0) { MessageBox.Show("无反馈码,请填写反馈码!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); // return; } try { string strDecodeBase32Code = DecodeBase32(FeedbackCode); JavaScriptSerializer js = new JavaScriptSerializer(); //strDecodeBase32Code = "bOnmE9pRclcmnXWd2rbyqkcjgWrG6HyktSxAD0x4xKy+il/Kb1Bf8ie96yW3y2usoU3kq9IDzG9dlV+MqcYPzg7OHkRBZ+eThw6rj03+gEUOlhHl1FbYQobCiLswo5BrbVkHbDUinxJpulNKvkQRRQsh65MXPdrwj2+8PZVFqLSgDVIX4V5OW/645Mi3G3gPwxsJPvZRsfDL7J6S03ZLMFUTJuUiu7Dz0UFTSDn47PZL35hiftb8m7WSaLiPQGcMRWq5iaz1D7PvoqfG+xAKrqlJJYQBRV/4xBmDpsMGoFknvyNQXWgLCumZ4Wxv2aTt1QyIZfc+wgRktpaULzfhGU5NhmwlzNZptuBIH32Klda439oSZT8omUR+ck+rhP9bnXddtcnj6YC2pyz0GRJPDrkAdaRHwJ/3RAXMrzyDVLye1B9YnD477OKMTKBX+OMEiqeS324j/M5miPEJgX5P4MxtBuNlX0dHHRfOF6dSxDc1/+EHXjhP0sI6Xou28tAAInQJYGFcptGzilXz7oaoj6wyak2Lwl/hNcAIyv5iCGebFd4z3xhozfYs4W4/ntLq9Ko++RjDjtUvksVJFepZc10UQVAov1EKS7Gfdi5QHFvj7G4PP61f0kBiM1x+I4HUxUezw0l0IjSGrF27KZ73mL96ZWg9UsubaTMNkQq+NBsfVX/HOwSpUCjhVt7PXBmqXGSK+TTjb5Qzm9aa9GaEsAjLmj/QFLl24kEPm9aJHjN09S8LA/Oh3dyR6wCKxiBtiyGNJNLMAa/XPjEWlq0jQbFlyQrnQvBdk+2pddo0tL77I++6N8a+hWsroD1VC+iIdMx11JDgd5R7GmV3qQIxLcnhzuvDDuPP0SpGOSYVjQoJV2+3fhz6uSHgZ4enqLTjOymcXLSCK8mona0LNg1nbvful1XV5lUnG172wrANGIZbXNtcG7ITUhiRLazuL6Otcqfu7wft2wzUmBZQJWY9cVlZBOFzyKE/KUbHDzO/NH0VG5TLA8H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QkJ+X2Wh/luJ7hoTTCiIXC4q9Efn2vCG74to5LgN5lhT7QQNnMGc2cqWeJ/Uj4evIZthzY5fzSXpO+u7OYaJF0xay5ZnKJQihlQP1n/uE/CoIRHxchPmYYRC47RYPHSD3Ct71UZNgZ+E3pJ0TjK++6qBkV5tOKGtpgiMxGsGl1LEnK9MLPXFIPXyiqFsk7QfjjuX6YRI7dYXNGQpx5IZ7MDYjn+J53z5ajJVMOEAVxiWMGxMguaLlTTguRjyGOdYmV54EXwslGZCDKTe8gY67HzurVzteUHepBX2RNErUQ7mGxBAkuAttdqGMDyNhF+cebqilBMM/ErLUpAXoJemlt5UGPBm9DhanjVeO5l4B53i8FzPW8ROPfwUv65TLP2eORSv1m5AAXCd7YDztfsWcSECjE+4JXE9XuZLTbXny2TuSkPDWXEHC8t5vMPjxH1F7pZ1j4xEwhLFPRr8NvELKIjA6yQaGjPiy0CG8FQFWmjL8LkFXj0k3RsLI8FdojehDjAV+tV6gsnRJFF/IcRveYS8v0DF6PQ+uiGaquf13pOP/Oj0J3spdNmT6uGSyb59a+k5OsgvUWEdWnT7fPLmByXrZfWbkOG8BrI6/kszvt2xJoK07JRp6rK2D10aHdjedHsWdZonHmC8nAdN8j8MN7fDwFxdccOTiUP7Df44VeClG3k4fDeTNVC"; //string strDecodeBase32Code1 = DeleteControlChar(strDecodeBase32Code); string strAesDecode = AesClass.AesDecrypt(strDecodeBase32Code); string strRSADecode = RsaDecrypt_(strAesDecode); //RSAFromPkcs8.BlockDecrypt(strAesDecode); string strBase32Decode = strRSADecode; // DecodeBase32(strRSADecode); string str = GetLastStr(strBase32Decode, 1); if (str != "}") { //strBase32Decode = RemoveLastChar(strBase32Decode, "\"}"); strBase32Decode = RemoveLastChar(strBase32Decode, ",\"Info\":"); //int a = strBase32Decode.IndexOf("\"Info\":"); //strBase32Decode += "\"}}"; strBase32Decode += ",\"Info\":0}}"; } JsonParser.JsonSign jsonSign = js.Deserialize <JsonParser.JsonSign>(strBase32Decode); string registerStortJson = StortJson(js.Serialize(jsonSign.data), false); //排序 if (Verify(registerStortJson, jsonSign.sing)) { //JsonParser.JsonRegister jsonRegister = js.Deserialize<JsonParser.JsonRegister>(strBase32Decode); JsonParser.JsonRegister jsonRegister = new JsonParser.JsonRegister(); jsonRegister = jsonSign.data; string jsonRegister_I = DecodeBase32(jsonRegister.I.ToString().Trim()); string jsonRegister_R = DecodeBase32(jsonRegister.R.ToString().Trim()); string jsonRegister_M = DecodeBase32(jsonRegister.M.ToString().Trim()); string jsonRegister_N = DecodeBase32(jsonRegister.N.ToString().Trim()); string jsonRegister_T = DecodeBase32(jsonRegister.T.ToString().Trim()); var buff = Convert.FromBase64String(jsonRegister_N); string str2 = System.Text.Encoding.Unicode.GetString(buff); jsonRegister.I = jsonRegister_I; jsonRegister.R = jsonRegister_R; jsonRegister.M = jsonRegister_M; jsonRegister.N = str2; jsonRegister.T = jsonRegister_T; string jsonCode = ConvertJsonString(js.Serialize(jsonRegister)); this.richTextBox3.Text = jsonCode; } }catch (Exception ex) { MessageBox.Show("错误 !" + ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); return; } }