//---------------------------------------------------------------------------------------------------- public static string DecryptAES(string aesIndex, string base64) { var user = UserSessionLogic.GetUser(); string rtn = "!"; if (user.AESKeysDict.ContainsKey(aesIndex)) { var aesKeyInfo = user.AESKeysDict[aesIndex]; rtn = AESLogic.DecryptServer(aesKeyInfo, base64); } return(rtn); }
//---------------------------------------------------------------------------------------------------- public static string EncryptAES(string aesIndex, string message) { AjaxService.ASPdatabaseService.GetSetVal(); var user = UserSessionLogic.GetUser(); string rtn = "!"; if (user.AESKeysDict.ContainsKey(aesIndex)) { var aesKeyInfo = user.AESKeysDict[aesIndex]; rtn = AESLogic.EncryptServer(aesKeyInfo, message); } return(rtn); }
//---------------------------------------------------------------------------------------------------- public static bool CaptureAESKey(string aesIndex, string base64) { AjaxService.ASPdatabaseService.GetSetVal(); var user = UserSessionLogic.GetUser(); string aes_JSON = RSALogic.Decrypt(user.Get__RSA_PrivateKey_XML(), base64); var aesKeyInfo = (new JavaScriptSerializer()).Deserialize <AESKeyInfo>(aes_JSON); if (!user.AESKeysDict.ContainsKey(aesIndex)) { user.AESKeysDict.Add(aesIndex, aesKeyInfo); } return(true); }
//---------------------------------------------------------------------------------------------------- public static string[] GetSessionPublicKey() { AjaxService.ASPdatabaseService.GetSetVal(); var rtn = new string[3]; var user = UserSessionLogic.GetUser(); if (String.IsNullOrEmpty(user.RSA_PublicKey_PEM)) { GenerateRSAKeys(user); } rtn[0] = Guid.NewGuid().ToString(); rtn[1] = user.RSA_PublicKey_PEM; rtn[2] = Guid.NewGuid().ToString(); return(rtn); }
//---------------------------------------------------------------------------------------------------- public static void DoLogout() { UserSessionLogic.ClearSessionUser(); }