Des encryption after get get URL parameter cannot decrypt problem

Source: Internet
Author: User


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)


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));


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.