在一个base-64字符串无效字符 [英] Invalid character in a Base-64 string
问题描述
获得在C#中涉及到的Base-64字符串的几个不同的例外情况。下面是与样本串沿例外。我不知道太多关于这个话题,但我相信我做确认下列字符串的长度是4的倍数。我希望这些问题都是相关的,但我不能肯定。任何帮助是AP preciated。
Getting a few different exceptions related to Base-64 strings in C#. Below are the exceptions along with sample string. I don't know too much about this topic but I believe I did confirm the lengths of the following strings are multiples of 4. I'm hoping these issues are all related but I'm not sure. Any help is appreciated.
无效字符在一个base-64字符串。
<$c$c>DcxWhbe30oLrUI69U41gSnm7eU2c8qOx7k/eKnSaG3ZDlv8BIPHJKxl0DStVUtsjdxufrZd30K4IAl0XxBIKgKUlOt4k+nVPrfCnM4HHzw19GHnYlTr2DLhw6iD0goEnMk+bJG2xWQ4wRLLn8KOj6DdBxTes6sdpoeWKxcAHPZ2FFXqC3MfQ+SMMV7re9YiY9ZpudFFr1QVRMztzinK5YA==$c$c>
"Invalid character in a Base-64 string."
DcxWhbe30oLrUI69U41gSnm7eU2c8qOx7k/eKnSaG3ZDlv8BIPHJKxl0DStVUtsjdxufrZd30K4IAl0XxBIKgKUlOt4k+nVPrfCnM4HHzw19GHnYlTr2DLhw6iD0goEnMk+bJG2xWQ4wRLLn8KOj6DdBxTes6sdpoeWKxcAHPZ2FFXqC3MfQ+SMMV7re9YiY9ZpudFFr1QVRMztzinK5YA==
的数据长度解密是无效的。
<$c$c>jq6xC0Dv+oeL0MXOei7wNIQgD+aon+S8N2ZfDyAO+5dlm/lIBYN+aCn2Xjnyi/XCzv7Liag5aaKXZ3b+7P7+R7lmarsT9ugnFrnvjInsvUxsbk4EAjIP55O9d7XXYnARW3yjW7klLyR0U9JjMVsISKThDtLe4rOJHgDvYahF454YOn5GlVXBoB+qNnLscGZ6$c$c>
"Length of the data to decrypt is invalid."
jq6xC0Dv+oeL0MXOei7wNIQgD+aon+S8N2ZfDyAO+5dlm/lIBYN+aCn2Xjnyi/XCzv7Liag5aaKXZ3b+7P7+R7lmarsT9ugnFrnvjInsvUxsbk4EAjIP55O9d7XXYnARW3yjW7klLyR0U9JjMVsISKThDtLe4rOJHgDvYahF454YOn5GlVXBoB+qNnLscGZ6
对于一个base-64字符数组长度无效。
<$c$c>C8MutyUPoTrmmnprFV3wqxMMVs7O5J4NA61jhZLaCSbwteklqGHFuuSlhf0mH8L5FLJ+jcrWuns2zz+Q/o5tA0DCDGnEAxDxKraR8Ip/iDUrTCS9ZAW0VrZpqUY4EPhyCbSpdU0OwfQ05eHXqwU6LIzz3gqavpi6AlMP9H5GYTaxsfQEByswjizWs5hO2ZmH$c$c>
"Invalid length for a Base-64 char array."
C8MutyUPoTrmmnprFV3wqxMMVs7O5J4NA61jhZLaCSbwteklqGHFuuSlhf0mH8L5FLJ+jcrWuns2zz+Q/o5tA0DCDGnEAxDxKraR8Ip/iDUrTCS9ZAW0VrZpqUY4EPhyCbSpdU0OwfQ05eHXqwU6LIzz3gqavpi6AlMP9H5GYTaxsfQEByswjizWs5hO2ZmH
推荐答案
当我去看看我用的是脱code中的字符串回应安德烈的问题是什么,我意识到,我一直在做一个假设这是从真正的问题我睁不开眼。
As I went to look at what I was using to decode the string in response to Andrey's question, I realized that I had been making an assumption that was blinding me from the real issue.
该数据串正在通过查询字符串参数传递,我是假设参数作为自定义错误消息我得到的是坏的字符串看到的时候,其实,稍微调试表明,我其实是试图字符串德code有空格。通过查询字符串张贴字符串是造成所有的加号(+)符号来得到德codeD插入空格。我能够从那里解决这个问题。
The data string is being passed through a querystring parameter and I was assuming that parameter as seen in the custom error message I was getting was the bad string when, in fact, a little debugging showed that the string I was actually attempting to decode had whitespaces. Posting the string through the querystring was causing all the plus (+) signs to get decoded into whitespace. I am able to resolve this issue from there.
感谢您给任何人谁花时间阅读这篇而被误导的问题。
Thank you to anyone who spent time reading this rather misguided question.
这篇关于在一个base-64字符串无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!