Java Base64 Parsing

Source: Internet
Author: User
Tags base64

Recently in the business scenario, we need to Base64 decrypt the characters passed in by the third party, parse the data according to the parsing tools provided by the third-party document, and parse the Base64 as follows:

              String sign = "xxxxxxxxxxxxxxxxxxxxxxxx";              Sun.misc.BASE64Decoder decode = new Sun.misc.BASE64Decoder ();      String json = new string (Decode.decodebuffer (sign));

Using Sun.misc.BASE64Decoder to parse the data, the test environment tests found that the parsed string was correct,

But after the launch, according to the third party's sign, after parsing out the string finally found a character "7", the query logic did not find the problem, The final guess is sun.misc.BASE64Decoder out of the problem, so change the Base64 resolution Jira, using the following code to parse:

String sign = "xxxxxxxxxxxxxxxxxxxxxxxxx"; Base64 base64 = new Base64 (); String json = new String (Base64.decodebase64 (Sign.getbytes ()));

Found the data returned in JSON is OK, problem solved.

Java Base64 Parsing

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: info-contact@alibabacloud.com 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.