예제 #1
0
파일: APIToken.cs 프로젝트: girishdubey/PMS
        public static string GetAPIKey()
        {
            string hashLeft  = string.Empty;
            string hashRight = string.Empty;
            string encry1    = string.Empty;
            string ticks;

            try
            {
                APIKeyModel _Model = new APIKeyModel();
                ticks = DateTime.UtcNow.Ticks.ToString();
                // [encry1] CLientIDToken : IPAddress : ticks
                encry1 = string.Join(":", new string[] { _Model.Token, _Model.IPAddress, ticks });

                // [encry2] UniqueID + ticks
                hashLeft  = Convert.ToBase64String(TripleDESAlgorithm.Encryption(encry1, _Model.EncryKey, _Model.IVKey));
                hashRight = string.Join(":", new string[] { _Model.UniqueID, ticks.ToString() });

                // [CLientIDToken : IPAddress : ticks + UniqueID + ticks]

                var basestring = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Join(":", hashRight, hashLeft)));

                return(basestring);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
파일: APIToken.cs 프로젝트: girishdubey/PMS
 public static string Decryption(string CypherText, APIKeyModel Model)
 {
     return(TripleDESAlgorithm.Decryption(CypherText, Model.EncryKey, Model.IVKey));
 }
예제 #3
0
파일: APIToken.cs 프로젝트: girishdubey/PMS
 public static byte[] Encryption(string PlainText, APIKeyModel Model)
 {
     return(TripleDESAlgorithm.Encryption(PlainText, Model.EncryKey, Model.IVKey));
 }
예제 #4
0
파일: APIToken.cs 프로젝트: girishdubey/PMS
        public static string Decryption(string CypherText)
        {
            APIKeyModel _Model = new APIKeyModel();

            return(TripleDESAlgorithm.Decryption(CypherText, _Model.EncryKey, _Model.IVKey));
        }
예제 #5
0
파일: APIToken.cs 프로젝트: girishdubey/PMS
        public static byte[] Encryption(string PlainText)
        {
            APIKeyModel _Model = new APIKeyModel();

            return(TripleDESAlgorithm.Encryption(PlainText, _Model.EncryKey, _Model.IVKey));
        }