From 25cb7cd50d12f48e93d6cde47420ca3458e9c47a Mon Sep 17 00:00:00 2001 From: helongyang <647556386@qq.com> Date: 星期四, 12 六月 2025 21:39:43 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs | 45 +++++++++------------------------------------ 1 files changed, 9 insertions(+), 36 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" index 19fad41..5c7cba4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpMesHelper.cs" @@ -23,15 +23,19 @@ using HttpClient httpClient = new HttpClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); - //string authorization = "AppKey 1830415116987195392"; - string authorization = "AppKey 1773317109539201024"; + //姝e紡 + string authorization = "AppKey 1830415116987195392"; + //娴嬭瘯 + //string authorization = "AppKey 1773317109539201024"; - + headers = new Dictionary<string, string> { { "Authorization", authorization }, - //{ "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } - { "Site_tenant_id", "ced19269-2b83-4577-be43-8cc2f700251e" } + //姝e紡 + { "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } + //娴嬭瘯 + //{ "Site_tenant_id", "ced19269-2b83-4577-be43-8cc2f700251e" } }; if (headers != null) { @@ -51,37 +55,6 @@ { Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); } - } - public static string GetStr(string textToEncrypt) - { - string publicKey; - string privateKey; - GenerateRSAKeyPair(out publicKey, out privateKey); - byte[] encryptedBytes = RSAEncrypt(textToEncrypt, publicKey); - // 鍙互灏嗗姞瀵嗗悗鐨勫瓧鑺傛暟缁勮浆鎹负Base64瀛楃涓叉柟渚垮悗缁鐞嗭紝渚嬪浼犺緭绛� - string encryptedBase64 = Convert.ToBase64String(encryptedBytes); - return encryptedBase64; - } - public static void GenerateRSAKeyPair(out string publicKey, out string privateKey) - { - using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(2048)) - { - publicKey = rsa.ToXmlString(false); - privateKey = rsa.ToXmlString(true); - } - } - public static byte[] RSAEncrypt(string plainText, string publicKey) - { - byte[] encryptedData; - using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) - { - rsa.FromXmlString(publicKey); - // 灏嗘枃鏈浆鎹负UTF8缂栫爜鐨勫瓧鑺傛暟缁� - byte[] plainBytes = Encoding.UTF8.GetBytes(plainText); - // 浣跨敤SHA1鍝堝笇绠楁硶浠ュ強Pkcs1濉厖瑙勫垯杩涜鍔犲瘑 - encryptedData = rsa.Encrypt(plainBytes, true); - } - return encryptedData; } } } -- Gitblit v1.9.3