/// <summary> /// 用M104解密 /// </summary> /// <param name="strSource"></param> /// <returns></returns> public static string DecryptWithM004(string strSource) { try { return(ServerAESEncryption.DecryptString(strSource, EncryptionMode.AES256V04Hex)); } catch { return(strSource); } }
private string DecryptString01(string strSource) { try { return(ServerAESEncryption.DecryptString(strSource, EncryptionMode.AES256V01Hex)); } catch { return(strSource); } }
private static string DecryptFromClient(string strSource) { try { return(ServerAESEncryption.DecryptString(strSource, EncryptionMode.AES256V04Hex)); } catch { return(strSource); } }
public string DecodeMessageValue(string strSource) { try { return(ServerAESEncryption.DecryptString(strSource, EncryptionMode.AES256V01B64)); } catch (Exception ex) { OnDebug(LogMode.Error, string.Format("DecodeMessageValue fail.\t{0}", ex.Message)); return(strSource); } }
public string DecryptString(string source, int mode, Encoding encoding) { return(ServerAESEncryption.DecryptString(source, (EncryptionMode)mode, encoding)); }
public string DecryptString(string source, int mode) { //return source; return(ServerAESEncryption.DecryptString(source, (EncryptionMode)mode, Encoding.ASCII)); }
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); } }