示例#1
0
 public static string DecryptString(string strSource)
 {
     try
     {
         return(ClientAESEncryption.DecryptString(strSource, EncryptionMode.AES256V04Hex));
     }
     catch (Exception ex)
     {
         return(strSource);
     }
 }
示例#2
0
 public static string DecryptString(string strSource)
 {
     try
     {
         return(ClientAESEncryption.DecryptString(strSource, EncryptionMode.AES256V04Hex));
     }
     catch (Exception ex)
     {
         CurrentApp.WriteLog("Encryption", string.Format("Fail.\t{0}", ex.Message));
         return(strSource);
     }
 }
示例#3
0
 public static string DecryptString(string strSource)
 {
     try
     {
         return(ClientAESEncryption.DecryptString(strSource, EncryptionMode.AES256V04Hex));
     }
     catch (Exception ex)
     {
         WriteLog("Decryption", ex.Message);
         return(strSource);
     }
 }
示例#4
0
 public byte[] EncryptBytes(byte[] source, int mode)
 {
     return(ClientAESEncryption.EncryptBytes(source, (EncryptionMode)mode));
 }
示例#5
0
 public string EncryptString(string source, int mode, Encoding encoding)
 {
     return(ClientAESEncryption.EncryptString(source, (EncryptionMode)mode, encoding));
 }
示例#6
0
 public string EncryptString(string source, int mode)
 {
     //return source;
     return(ClientAESEncryption.EncryptString(source, (EncryptionMode)mode, Encoding.ASCII));
 }
示例#7
0
        void BtnDescrypt_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var typeItem = ListBoxType.SelectedItem as EncryptionTypeItem;
                var modeItem = ComboMode.SelectedItem as EncryptionModeItem;
                var encItem  = ListBoxEncoding.SelectedItem as EncryptionEncodingItem;
                if (typeItem == null || modeItem == null || encItem == null)
                {
                    return;
                }

                string strSource = TxtSource.Text;
                string strReturn = string.Empty;
                //string strTemp;

                int      mode     = (int)modeItem.Mode;
                int      type     = mode / 1000;
                Encoding encoding = encItem.Encoding;
                switch (type)
                {
                case 1:
                    //do
                    //{
                    //    if (strSource.Length > 128)
                    //    {
                    //        strTemp = strSource.Substring(0, 128);
                    //        strSource = strSource.Substring(128, strSource.Length - 128);
                    //    }
                    //    else
                    //    {
                    //        strTemp = strSource;
                    //        strSource = string.Empty;
                    //    }
                    //    if (typeItem.Value == 1)
                    //    {
                    //        strReturn += ClientAESEncryption.DecryptString(strTemp, modeItem.Mode, encoding);
                    //    }
                    //    else
                    //    {
                    //        strReturn += ServerAESEncryption.DecryptString(strTemp, modeItem.Mode, encoding);
                    //    }

                    //} while (strSource.Length > 0);
                    if (typeItem.Value == 1)
                    {
                        strReturn = ClientAESEncryption.DecryptString(strSource, modeItem.Mode, encoding);
                    }
                    else
                    {
                        strReturn += ServerAESEncryption.DecryptString(strSource, modeItem.Mode, encoding);
                    }
                    break;

                default:
                    ShowErrorMessage(string.Format("EncryptMode invalid.\t{0}", modeItem.Mode));
                    return;
                }
                AppendMessage(strReturn);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }