예제 #1
0
        /// <summary>
        /// Получить хеш-функцию для защиты cookie пользователя
        /// </summary>
        private static string GetCookieHash(string login, NameValueCollection headers)
        {
            string headersStr = headers == null ? "" :
                                headers["Accept"] + headers["Accept-Encoding"] + headers["Accept-Language"] + headers["User-Agent"];

            return(ScadaUtils.ComputeHash(login + headersStr + SecretKey));
        }
예제 #2
0
        /// <summary>
        /// Gets an encrypted server stamp.
        /// </summary>
        public static string GetServerStamp(long sessionID, byte[] secretKey)
        {
            byte[] bytes = secretKey == null
                ? BitConverter.GetBytes(sessionID)
                : ScadaUtils.EncryptBytes(BitConverter.GetBytes(sessionID), secretKey, CreateIV(sessionID));

            return(ScadaUtils.ComputeHash(bytes));
        }