Example #1
0
        public string SHA384_Encoding(string s)
        {
            string strResult = "";

            try
            {
                IntCrypt.IntCryptLib crypt = new IntCrypt.IntCryptLib();
                strResult = crypt.SHA384_Encoding(s);
            }
            catch (Exception)
            {
            }

            return(strResult);
        }
Example #2
0
        public string SHA512_Encoding_UTF8(string s)
        {
            string strResult = "";

            try
            {
                IntCrypt.IntCryptLib crypt = new IntCrypt.IntCryptLib(Encoding.UTF8);
                strResult = crypt.SHA512_Encoding(s);
            }
            catch (Exception)
            {
            }

            return(strResult);
        }
Example #3
0
        public string Base64_Decoding(string s)
        {
            string strResult = "";

            try
            {
                IntCrypt.IntCryptLib crypt = new IntCrypt.IntCryptLib();
                strResult = crypt.Base64_Decoding(s);
            }
            catch (Exception)
            {
            }

            return(strResult);
        }
Example #4
0
        public string AES_Decrypt_UTF8(string strDomain, string strApp, string s)
        {
            string strResult = "";

            try
            {
                byte[] key = null;
                byte[] iv  = null;
                keymanager_.GetKeyIv(strDomain, strApp, ref key, ref iv);

                IntCrypt.IntCryptLib crypt = new IntCrypt.IntCryptLib(Encoding.UTF8);
                strResult = crypt.AES_Decrypt(key, iv, s);
            }
            catch (Exception)
            {
            }

            return(strResult);
        }
Example #5
0
        private bool CacheKeyRepo(string strDomain)
        {
            bool bSuccess = false;

            try
            {
                string sType        = "SERIALIZE";
                string strSerialize = GetKeyRepository(strDomain);

                if (strSerialize.Substring(0, KEY_PROTO.Length) == KEY_PROTO)
                {
                    strSerialize = strSerialize.Substring(KEY_PROTO.Length, strSerialize.Length - KEY_PROTO.Length);

                    // default key로 키 복호화
                    IntCrypt.IntCryptLib crypt = new IntCrypt.IntCryptLib();
                    strSerialize = crypt.AES_Decrypt(default_key, default_iv, strSerialize);

                    sType = KEY_PROTO;
                }

                MemoryStream    stream = new MemoryStream(Convert.FromBase64String(strSerialize));
                BinaryFormatter fmt    = new BinaryFormatter();

                KeyType repo = (KeyType)fmt.Deserialize(stream);
                keyman_.Add(strDomain, repo);

                Trace.WriteLine(string.Format("IntCryptLib::CacheKeyRepo : [{0}] {1}", sType, strDomain));
                bSuccess = true;
            }
            catch (Exception)
            {
                Trace.WriteLine(string.Format("IntCryptLib::CacheKeyRepo [Failed]: {0}", strDomain));
            }

            return(bSuccess);
        }