public static string decryptData(string resData, string privateKey, string input_charset) { byte[] numArray = Convert.FromBase64String(resData); List <byte> nums = new List <byte>(); for (int i = 0; i < (int)numArray.Length / 128; i++) { byte[] numArray1 = new byte[128]; for (int j = 0; j < 128; j++) { numArray1[j] = numArray[j + 128 * i]; } nums.AddRange(RSAFromPkcs8.decrypt(numArray1, privateKey, input_charset)); } byte[] array = nums.ToArray(); char[] chrArray = new char[Encoding.GetEncoding(input_charset).GetCharCount(array, 0, (int)array.Length)]; Encoding.GetEncoding(input_charset).GetChars(array, 0, (int)array.Length, chrArray, 0); return(new string(chrArray)); }
public static string decryptData(string resData, string privateKey, string input_charset) { byte[] array = Convert.FromBase64String(resData); List <byte> list = new List <byte>(); for (int i = 0; i < array.Length / 128; i++) { byte[] array2 = new byte[128]; for (int j = 0; j < 128; j++) { array2[j] = array[j + 128 * i]; } list.AddRange(RSAFromPkcs8.decrypt(array2, privateKey, input_charset)); } byte[] array3 = list.ToArray(); char[] array4 = new char[Encoding.GetEncoding(input_charset).GetCharCount(array3, 0, array3.Length)]; Encoding.GetEncoding(input_charset).GetChars(array3, 0, array3.Length, array4, 0); return(new string(array4)); }