From 817e244ee91924f618452a8abd5190c096c1fb5c Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Mon, 4 Mar 2019 10:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=AB=99=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=B1=BB=EF=BC=8C=E4=B8=87=E4=BB=95=E8=BE=BE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8A=A0=E5=AF=86key=E4=BB=8E=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs | 2 +- WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj | 1 + WebSiteCode/Cmdjy/Cmdjy/Web.config | 4 ++++ WebSiteCode/Cmdjy/Cmdjy/WebSettings.cs | 27 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 WebSiteCode/Cmdjy/Cmdjy/WebSettings.cs diff --git a/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs b/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs index acfc1b9..9e4d97d 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs @@ -76,7 +76,7 @@ namespace Cmdjy.Bll /// public static DesHelper GetHelper() { if(_deshelper == null) { - var key = ""; + var key = WebSettings.DesKey; byte[] IV = { 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 }; _deshelper = GetHelper(PaddingMode.PKCS7,CipherMode.CBC,IV,key); diff --git a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj index 05255ad..23e3bda 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj +++ b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj @@ -165,6 +165,7 @@ Global.asax + HisInterface.asmx Component diff --git a/WebSiteCode/Cmdjy/Cmdjy/Web.config b/WebSiteCode/Cmdjy/Cmdjy/Web.config index 129ea88..a2d1a61 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Web.config +++ b/WebSiteCode/Cmdjy/Cmdjy/Web.config @@ -13,6 +13,10 @@ + + + + + /// 网站配置 + /// + public static class WebSettings + { + /// + /// 获取配置的值 + /// + /// + /// + public static string GetValue(String key) { + var val = ConfigurationManager.AppSettings[key]; + return val; + } + /// + /// 万仕达加密通信用的的加密key + /// + public static string DesKey { + get => GetValue("DesKey") ?? throw new Exception("必须在web.config文件appSettings节配置DesKey的值"); + } + } +} \ No newline at end of file