Easy payment of first mail and recharge interface

Source: Internet
Author: User
The first mail is easy to pay, and the recharge interface uses the data encryption form: md5 + des

Package com. test. moltest; import net. sf. json. JSONObject; import com. huonet. util. DESTools; import com. huonet. util. userJsonUtil; public class assumerecharg {public static void main (String [] argv) throws Exception {// call the recharge interface String application_value = "recharge"; String account = "paybyte "; string mobile = "13581570818"; String orderid = "201305133127"; String amount = "100"; JSONObject jobj = new JSONObject (); jobj. accumulate ("application_value", application_value); jobj. accumulate ("account", account); jobj. accumulate ("mobile", mobile); jobj. accumulate ("amount", amount); jobj. accumulate ("orderid", orderid); String s = java.net. URLEncoder. encode (UserJsonUtil. encryptJsonUser (jobj); String res =" http://www1.beijing.com.cn/user/api/mobile_test.jsp?s= "+ S; System. out. println ("res =" + res); // call end // process returned results // res = "Hangzhou/FRlHdmk4UFxExX0bEeH + pbi9guWDjTju/Summary ="; System. out. println (UserJsonUtil. decryptJsonUser1 (res. trim (); s = DESTools. decrypt ("testtest", s); // decrypts 1 jobj = JSONObject. fromObject (s); System. out. println (jobj );}}



How does PHP call this interface?


Reply to discussion (solution)

Who will send a post to pick up the next point? I want to close the post.

What is this, Yixin?

What have you done? I have been working on it recently. I am still preparing for it, but I have no idea... Let's talk about your solution...

Score

Share the code...

Share The Author's code

There are still problems with md5 encryption and decryption in java.

Http://www1.beijing.com.cn/user/api/mobile_test.jsp, isn't it an interface file?

This problem has been solved. you can run java once to find out the process in it.
If someone will study this part in the future, you can look at the following code.

'{"application_value":"recharge","account":"payease","mobile":"13581570818","amount":"100","orderid":"201305133127","md5":"ebd99a76ad1747dc97136769d1a085a0"}';

The md5 key is the data encrypted by hash md5.
The encrypted data is rechargepayease13581570818100201305133127.
Perform DES encryption on the above code.
Then, you can obtain a string of encrypted data by requesting the url address, which can be decrypted.

Decryption is simple.
Decrypt a string of data through DES, and then decode it using JSON to get an object, that is, the real data.

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.