no

Rijndael Invalid length for a Base-64 char array

I have a requirement to send a variable from a link to a page. But the variable should be encrypted. And md5 will not work because I'm u...

I have a requirement to send a variable from a link to a page. But the variable should be encrypted. And md5 will not work because I'm using entity framework and it doesn't recognized the md5 function.

So I implement encryption using Rijndael. I downloaded the class from microsoft and it's working properly in my test cases. So I immediately put it on my web page, but from time to time I got the error above. Note that I already encoded/decoded the variable. What I noticed is that the '+' character is being replaced by a space, weird. I don't have any explanation to this. So what I did was simply revert back ' ' to '+' character, as shown in the following code:

var s = HttpUtility.UrlDecode(Request.QueryString["param"]);
s = s.Replace(" ", "+");
var id = Rijndael.DecryptStringAes(s);

Related

.net 3036981034377066665

Post a Comment

item