diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml
index 8be367fb2..5a810c297 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml
@@ -16,7 +16,7 @@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs
index 7bb1ee54f..17fe6fecf 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs
@@ -96,11 +96,11 @@ namespace Learun.Application.Web.Controllers
var url = perm_application.FInterfaceUrl;
if (url.Contains("?"))
{
- url += "&appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
+ url += "&appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode);
}
else
{
- url += "?appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
+ url += "?appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode);
}
return Redirect(url);
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs
index 8a69aff7c..b06cb9811 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs
@@ -153,14 +153,19 @@ namespace Learun.Application.WebApi.Modules
//写入当前请求所登录的用户
var code = Util.CommonHelper.RndNum(9);
cache.Write(code, userinfo.account, TimeSpan.FromMinutes(10));
+ string tyrz = ConfigurationManager.AppSettings["tyrz"];
+ if (!perm_application.FSecret.IsEmpty())
+ {
+ tyrz = perm_application.FSecret;
+ }
var url = perm_application.FInterfaceUrl;
if (url.Contains("?"))
{
- url += "&appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
+ url += "&appkey=" + Md5Helper.Encrypt("tyrz", 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, "tyrz") + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, "tyrz");
}
else
{
- url += "?appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
+ url += "?appkey=" + Md5Helper.Encrypt("tyrz", 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, "tyrz") + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, "tyrz");
}
return Success(new{ FInterfaceUrl=url });
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs
index 49125c9c6..f34b8dfa2 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs
@@ -31,13 +31,20 @@ namespace Learun.Util
///
需要加密的内容
///
秘钥
///
- public static string Encrypt(string Text, string sKey)
+ public static string Encrypt(string Text, string sKey, bool md5 = true)
{
+ var key = sKey;
+ var iv = sKey;
+ if (md5)
+ {
+ key = Md5Helper.Hash(sKey).ToUpper().Substring(0, 8);
+ iv = Md5Helper.Hash(sKey).ToUpper().Substring(0, 8);
+ }
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray;
inputByteArray = Encoding.Default.GetBytes(Text);
- des.Key = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8));
- des.IV = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8));
+ des.Key = ASCIIEncoding.ASCII.GetBytes(key);
+ des.IV = ASCIIEncoding.ASCII.GetBytes(iv);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
@@ -75,8 +82,15 @@ namespace Learun.Util
///
需要解密的内容
///
秘钥
///
- public static string Decrypt(string Text, string sKey)
+ public static string Decrypt(string Text, string sKey, bool md5 = true)
{
+ var key = sKey;
+ var iv = sKey;
+ if (md5)
+ {
+ key = Md5Helper.Hash(sKey).ToUpper().Substring(0, 8);
+ iv = Md5Helper.Hash(sKey).ToUpper().Substring(0, 8);
+ }
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
int len;
len = Text.Length / 2;
@@ -87,8 +101,8 @@ namespace Learun.Util
i = Convert.ToInt32(Text.Substring(x * 2, 2), 16);
inputByteArray[x] = (byte)i;
}
- des.Key = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8));
- des.IV = ASCIIEncoding.ASCII.GetBytes(Md5Helper.Hash(sKey).ToUpper().Substring(0, 8));
+ des.Key = ASCIIEncoding.ASCII.GetBytes(key);
+ des.IV = ASCIIEncoding.ASCII.GetBytes(iv);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);