解码方法有误 [英] Error in decoding method

查看:93
本文介绍了解码方法有误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的解码方法:



This is the my decoding method:

public static string DecodeFrom64(string m_enc)
   {
       byte[] encodedDataAsBytes =
       System.Convert.FromBase64String(m_enc);
       string returnValue =
       System.Text.Encoding.UTF8.GetString(encodedDataAsBytes);
       return returnValue;
   }





错误是:

输入无效Base-64字符串,因为它包含一个非基本的64个字符,两个以上的填充字符,或填充字符中的非空格字符。





为什么我收到此错误任何人请帮助我...



The error is:
The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters.


Why i am getting this error any one pls help me...

推荐答案

错误消息非常具体:因为它包含非-base 64个字符,两个以上的填充字符,或填充字符中的非空格字符



所以,我猜你要么没有正确地将您的字符串转换为Base 64,或者您已将其损坏。在不了解您的应用程序的情况下,我们不能说更多。



首次转换后查看字符串。它看起来像你想要转换回来的那个吗?如果没有,怎么回事?为什么不呢?



BTW:您是否意识到Base64不是加密系统?如果你试图使用它,它就像在你的个人日记的外面写不要阅读一样安全吗?
The error message is pretty specific: "as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters"

So, I would guess that you either haven't converted your string to Base 64 correctly, or you have corrupted it since. Without knowing more about you application, we can't say much more.

Look at the string when you have first converted it. Does it look like the one you are trying to convert back? If not, how not? And Why not?

BTW: You do realize that Base64 is not an encryption system? That if you are trying to use it as such, it is about as secure as writing "DO NOT READ" on the outside of your personal diary?


这篇关于解码方法有误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆