Example of parameter encryption code in Android data transmission

During Android development, it is inevitable to encounter the problem that some data contents need to be encrypted and decrypted, stored in local files, or transmitted to other servers and devices through the network, but encryption is not absolutely safe. If the encryption function is used incorrectly, the encrypted data is vulnerable to reverse cracking attacks. There are many encryption algorithm problems that developers are not aware of.

1. Data transmission

1) In HTTP requests, there are two most commonly used methods: get and post; Generally, post requests are suitable for submission, while get requests are suitable for requesting data

2) There are three commonly used methods for data encryption: AES, DES and Base64

2. Base64 encryption

AES encryption is used here, and then the string is encoded by Base64. Among them, vectors are added to improve the difficulty of encryption cracking. The method of parameter encryption is as follows:

3. Problems encountered

During the process of using Base64, some problems are encountered, as follows:

1) The requested string is truncated. After grabbing the link, you get a string of spaces. After analysis, in fact, this is a new line.....

The solution is to process the output string as follows:

2) In addition to the above because of line feed, there are spaces. At this time, you can use substitution as follows:

4. Summary

Base64encode will truncate the string after 76 bits. In the case of Chinese strings, the plus sign will be replaced with a space.

The above is all about the parameter encryption code example in Android data transmission in this article. I hope it will be helpful to you. Interested friends can continue to refer to this website:

Introduction to file association method for Android Development

Detailed explanation of Android subcontracting multidex strategy

If there are deficiencies, please leave a message to point out.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>