From 70fb4c6b21cc5f29460b5e919a38b327a26fec1b Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 8 Mar 2019 09:58:56 +0800 Subject: [PATCH 1/2] DNN-29484: switch encrypt method. --- .../Services/Personalization/PersonalizationController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DNN Platform/Library/Services/Personalization/PersonalizationController.cs b/DNN Platform/Library/Services/Personalization/PersonalizationController.cs index e42101fc3ed..8e26c45e840 100644 --- a/DNN Platform/Library/Services/Personalization/PersonalizationController.cs +++ b/DNN Platform/Library/Services/Personalization/PersonalizationController.cs @@ -174,9 +174,9 @@ private static string DecryptData(string profileData) private static string GetDecryptionkey() { var machineKey = Config.GetDecryptionkey(); - var hostGuid = Host.GUID.Replace("-", string.Empty); - var key = (machineKey ?? "") + hostGuid; - return PortalSecurity.Instance.Encrypt(key, key); + var hostGuid = Host.GUID; + var key = $"{machineKey ?? ""}{hostGuid.Replace("-", string.Empty)}"; + return FIPSCompliant.EncryptAES(key, key, hostGuid); } } } \ No newline at end of file From cbc27827ff440fd127e9a44acf4e6f743c4c1667 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 11 Mar 2019 18:50:42 +0800 Subject: [PATCH 2/2] DNN-29484: update code by review. --- .../Services/Personalization/PersonalizationController.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DNN Platform/Library/Services/Personalization/PersonalizationController.cs b/DNN Platform/Library/Services/Personalization/PersonalizationController.cs index 8e26c45e840..0cc2f082bb1 100644 --- a/DNN Platform/Library/Services/Personalization/PersonalizationController.cs +++ b/DNN Platform/Library/Services/Personalization/PersonalizationController.cs @@ -174,9 +174,8 @@ private static string DecryptData(string profileData) private static string GetDecryptionkey() { var machineKey = Config.GetDecryptionkey(); - var hostGuid = Host.GUID; - var key = $"{machineKey ?? ""}{hostGuid.Replace("-", string.Empty)}"; - return FIPSCompliant.EncryptAES(key, key, hostGuid); + var key = $"{machineKey ?? ""}{Host.GUID.Replace("-", string.Empty)}"; + return FIPSCompliant.EncryptAES(key, key, Host.GUID); } } } \ No newline at end of file