Beispiel #1
0
        public string Decrypt(string cipherText)
        {
            try
            {
                if (cipherText == null)
                {
                    cipherText = "";
                }

                if (!IsEncryptDataActive)
                {
                    return(cipherText);
                }

                cipherText = MakeDecryptToUpper(cipherText);
                foreach (var item in _replaceItem)
                {
                    cipherText = cipherText.Replace(item.Value, item.Key);
                }


                _exceptionData = null;
                var result = EncryptDecryptUtilities.Decrypt3(cipherText, PublicKey, PrivateKey, out _exceptionData);

                return(result);
            }
            catch (Exception ex)
            {
                _exceptionData = ex;
                return("NULL");
            }
        }
Beispiel #2
0
        public string Encrypt(string clearTex)
        {
            try
            {
                if (clearTex == null)
                {
                    clearTex = "";
                }


                if (!IsEncryptDataActive)
                {
                    return(clearTex);
                }

                _exceptionData = null;
                var result = EncryptDecryptUtilities.Encrypt3(clearTex, PublicKey, PrivateKey, out _exceptionData);

                foreach (var item in _replaceItem)
                {
                    result = result.Replace(item.Key, item.Value);
                }



                return(MakeEncryptToLower(result));
            }
            catch (Exception ex)
            {
                _exceptionData = ex;
                return("NULL");
            }
        }