输入不是有效的基本-64字符串,因为它包含一个非基本64个字符,超过两个填充字符,
这是我使用的代码。当我本地运行时,它可以正常工作。但是,当我将所有DLL放到远程计算机上时,我会一直遇到此错误:
输入不是有效的基本-64字符串,因为它包含一个非基础64个字符,超过两个填充字符或填充中的非法字符人物。
public static string Decrypt(string cipherText)
{
if (cipherText == string.Empty)
return string.Empty;
byte[] cipherBytes = Convert.FromBase64String(cipherText);
PasswordDeriveBytes pdb = new PasswordDeriveBytes(
new byte[] { 0x50, 0x00, 0x41, 0x00, 0x43, 0x00, 0x43, 0x00, 0x41, 0x00, 0x52, 0x00, 0x34, 0x00, 0x32, 0x00,
0x35, 0x00, 0x34, 0x00, 0x36, 0x00, 0x38, 0x00, 0x37, 0x00, 0x34, 0x00, 0x30, 0x00, 0x30, 0x00, },
new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
byte[] decryptedData = Decrypt(cipherBytes, pdb.GetBytes(32), pdb.GetBytes(16));
return System.Text.Encoding.Unicode.GetString(decryptedData);
}
有人可以帮我弄清楚吗?我有检查机器,看来机器的NET 4.5及更高。我已经在.NET 4.0上构建了我的应用程序。除此之外,我无法弄清楚错误在哪里
Here is the code i am using. It works fine when i run locally. but when i drop all my dlls to a remote machine i keep getting this error:
The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
public static string Decrypt(string cipherText)
{
if (cipherText == string.Empty)
return string.Empty;
byte[] cipherBytes = Convert.FromBase64String(cipherText);
PasswordDeriveBytes pdb = new PasswordDeriveBytes(
new byte[] { 0x50, 0x00, 0x41, 0x00, 0x43, 0x00, 0x43, 0x00, 0x41, 0x00, 0x52, 0x00, 0x34, 0x00, 0x32, 0x00,
0x35, 0x00, 0x34, 0x00, 0x36, 0x00, 0x38, 0x00, 0x37, 0x00, 0x34, 0x00, 0x30, 0x00, 0x30, 0x00, },
new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
byte[] decryptedData = Decrypt(cipherBytes, pdb.GetBytes(32), pdb.GetBytes(16));
return System.Text.Encoding.Unicode.GetString(decryptedData);
}
Can someone please help me figure out? i have check the machine and it seems that machine has .NET 4.5 and higher. and I have built my application on .Net 4.0. Other than that i am not able to figure out where is the error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论