Exemple #1
0
        //----------------------------------------------------------------------------------------------------
        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);
        }
Exemple #2
0
        //----------------------------------------------------------------------------------------------------
        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);
        }
Exemple #3
0
        //----------------------------------------------------------------------------------------------------
        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);
        }
Exemple #4
0
        //----------------------------------------------------------------------------------------------------
        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);
        }
Exemple #5
0
 //----------------------------------------------------------------------------------------------------
 public static void DoLogout()
 {
     UserSessionLogic.ClearSessionUser();
 }