Set user groups
This commit is contained in:
@@ -46,21 +46,31 @@ namespace FoodsharingSiegen.Shared.Helper
|
||||
/// Decrypts the crypted text (a. beging, 04.04.2022)
|
||||
/// </summary>
|
||||
/// <param name="cryptedText">The crypted text</param>
|
||||
/// <param name="plainText"></param>
|
||||
/// <returns>The string</returns>
|
||||
public static string Decrypt(string cryptedText)
|
||||
public static bool TryDecrypt(string cryptedText, out string plainText)
|
||||
{
|
||||
CreateAlgorithm(out var tripleDes);
|
||||
plainText = string.Empty;
|
||||
|
||||
var toEncryptArray = Convert.FromBase64String(cryptedText);
|
||||
|
||||
try
|
||||
{
|
||||
CreateAlgorithm(out var tripleDes);
|
||||
|
||||
var toEncryptArray = Convert.FromBase64String(cryptedText);
|
||||
|
||||
var cTransform = tripleDes.CreateDecryptor();
|
||||
var resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
||||
var cTransform = tripleDes.CreateDecryptor();
|
||||
var resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
||||
|
||||
tripleDes.Clear();
|
||||
tripleDes.Clear();
|
||||
|
||||
return Encoding.UTF8.GetString(resultArray);
|
||||
plainText = Encoding.UTF8.GetString(resultArray);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user