Reference: http://www.cnblogs.com/lori/archive/2011/09/08/2170979.html
The problem is the URL encoding problem, if the URL is not encoded directly, then in the decoding, if the string exists "+" this special symbol, in the decoding will be replaced by "", at this time in the decryption will not be solved, resulting in the wrong result.
I solve the method:
First, the character first encryption , and then URL encoding , then does not appear the + number and other characters, and then get the parameters after the direct decryption (because there is no percentage of the parameters obtained) can, note, here I also do not understand, it is estimated that the browser automatically URL decoding or a filter in front of the processing??
Some of the code is as follows: (Specific DES encryption decryption code and URL encryption decryption code to see the previous problem)
Encryption:
long endtimes = System.currenttimemillis () +1*24*3600*1000= personname+ ";" +email+ ";" +endtimes; // first encryption, then URL transcoding, the order can not be modified String encode = urlutil.geturlencoderstring (Desutil.encrypt (para));
Decrypt:
String VC = Context.getparameter ("VC"); if (null! =vc) {try {// Direct des decode String decode = Desutil.decrypt (VC); = Emailutil.parsecontent (decode, ";") ); Catch (Exception e) { e.printstacktrace (); Context.setrequestattribute ("errormsg", "link invalid!") "); } }
Des encryption after get get URL parameter cannot decrypt problem