对方公司用apache.commons.codec.binary.Base64.encodeBase64编码并AES,我方在C#中AES有时解码不出来直接报错,有时解码出来的字符串末尾没有==,AES中base64解码用的就是默认的Convert.FromBase64String,我如果手动在末尾没有==的情况手动加入==解出来的字符串末尾可能是个奇怪的符号?,下面是我的AES解码方法: private static String AesDecrypt(string encryptedSource, string key) {
Byte[] _Key = Convert.FromBase64String(key);
Aes aes = Aes.Create("AES");
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
aes.Key = _Key;
aes.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
ICryptoTransform cTransform = aes.CreateDecryptor();
Byte[] encryptedData = Convert.FromBase64String(encryptedSource);
Byte[] originalSrouceData = cTransform.TransformFinalBlock(encryptedData, 0, encryptedData.Length);
String originalString = Encoding.UTF8.GetString(originalSrouceData);
return originalString;
}百度找了半天apache.commons.codec.binary.Base64.encodeBase64的c#版,找不到,该如何是好