我收到以下查询的错误 [英] I am getting the error for the below query

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

问题描述

你好,

Hello,

cs.Write(inputBytearray, 0, inputBytearray.Length);
                  cs.FlushFinalBlock();



在这里,我收到类似



here i am getting error like

'Length of the data to decrypt is invalid.'



任何人都可以帮助我

谢谢.



any one help me

thanks.

推荐答案

亲爱的朋友,

由于应用了加密技术,因此可能会出现此错误.您可能已应用了较低位的加密技术,并且正在加密较大的值,这就是为什么您无法获得解密写入的原因.
请粘贴应用的加密技术以及要加密的字符串,以便我可以建议您做什么.

您也可以参考此链接以供参考:-

https://forums.asp.net/t/1225162.aspx [
Dear Friend,

This error might come due to the encryption technique applied. you might have applied an encryption technique with lower bit and you are encrypting a larger value thats why you are not able to get the decryption write.

Please paste the encryption technique applied and also the string you are encrypting so that i can suggest you to what to do.

Also you can refer this link for reference:-

https://forums.asp.net/t/1225162.aspx[^]

Hope this will help you out.

Thanks


亲爱的KNR,

尝试使用此代码,因为这对我来说非常好.希望这对您有帮助:-

Dear KNR,

Try this code as this is perfectly fine for me. I hope this will help you out:-

public string EncryptString(string pwd)
        {
          try
          {
            byte[] strByte = new byte[pwd.Length];
            strByte = System.Text.Encoding.UTF8.GetBytes(pwd);
            string encodedPwd = Convert.ToBase64String(strByte);
            return encodedPwd;
          }
          catch
          {
            return null;
          }
        }
        public string DecryptString(string pwd)
        {
          try
          {
            UTF8Encoding encoder = new System.Text.UTF8Encoding();
            Decoder utf8Decode = encoder.GetDecoder();

            byte[] toDecode_byte = Convert.FromBase64String(pwd);
            int charCount = utf8Decode.GetCharCount(toDecode_byte, 0, toDecode_byte.Length);
            char[] decoded_char = new char[charCount];
            utf8Decode.GetChars(toDecode_byte, 0, toDecode_byte.Length, decoded_char, 0);
            string decodedPwd = new string(decoded_char);
            return decodedPwd;
          }
          catch
          {
            return null;
          }
        }


^ ]


这篇关于我收到以下查询的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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