存储过程中的解密 [英] Decryption In Stored Procedure

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

问题描述





当我运行解密方法时,它显示异常为

Base-64的长度无效char数组



byte [] toEncryptArray = Convert.FromBase64String(cipherString);

byte [] toEncryptArray = Convert.FromBase64String(cipherString。替换(,+));



以上两种说法不起作用





请给出上述问题的正确解决方案





提前致谢

解决方案

错误意味着它所说的。你的字符串无效,甚至不是正确的长度。


.FromBase64String()是一个采用特殊格式字符串的函数。这个字符串基本上是以base 64编码的数据,你不能将任何旧字符串传递给这个函数并得到一个字节数组。



为了得到一个字节字符串中的数组,使用以下函数:



 System.Text.ASCIIEncoding.ASCII.GetBytes(cipherString)





另外,我不知道你是什么。在字符串中替换,因为第一个替换字符串为空,它将抛出ArgumentException。 / BLOCKQUOTE>

Hi,

When I am running the decryption method it is showing the exception as
"Invalid length for a Base-64 char array "

byte[] toEncryptArray = Convert.FromBase64String(cipherString);
byte[] toEncryptArray = Convert.FromBase64String(cipherString.Replace("", "+"));

The above 2 statements are not working


Please give the proper solution for the above problem


Thanks in advance

解决方案

The error means what it says. Your string is not valid, it's not even the right length.


.FromBase64String() is a function that takes a specially formatted string. This string is basically data encoded in base 64, you can't pass any old string into this function and get out a byte array.

In order to get a byte array from a string, use the following function:

System.Text.ASCIIEncoding.ASCII.GetBytes(cipherString)



Also, I don't know what you are .Replacing in the string, since the first replace string is empty, it will throw an ArgumentException.


这篇关于存储过程中的解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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