Android MD5 encryption, RSA encryption

Source: Internet
Author: User
Tags md5 encryption

Now the company does the financial project, need to consider the security encryption aspect question. Thanks to my colleague Daniel (Funggo), I am very helpful.

With security optimizations in mind, we put the secret key and encryption steps into the native. Technology to consider: (1) JNI, (2) OpenSSL encryption library.

Android uses C + + code for cryptographic operations: Unlike previous JNI developments, since studio2.2 has added cmack external build tools, we write C + + code with automatic completion hints. Added the option "" Include C + + support when creating the project, tick it to create the NDK project automatically.

Before you create a project, you need to configure the required tools for the NDK, as well as environments that may cause C + + code not to prompt

Here is a reference from: http://blog.csdn.net/cuiyufeng2/article/details/64125594

I created the NDK project as follows:

In a different place from our usual Java project:

. Externalnativebuild folder (auto-generated), CPP folder (for C + + code), CMakeLists.txt file (CMake script configuration file), Build.gradle (the path to the CMakeLists.txt file) under the app.

It is important to note that the C code. cpp file that you create needs to indicate the path in the CMakeLists.txt file, or you will get an error.

With the introduction of the OpenSSL encryption library, OpenSSL encapsulates a large number of cryptographic algorithms, greatly simplifying our cryptographic operations. Here is not much to say, below I will put on my own small demo.

Here is a sentence: * * * * * MD5 encryption is irreversible, do not say wrong.

There is also the use of RSA encryption, not the same secret key encryption decryption. We put the public key on the client, the private key on the server (for security, the client cannot have the private key).

Usually in the project development, the client public key encrypted data to the server, the service to the data after the decryption of the private key, the server processing results are then encrypted with the private key to the client, the client receives the service to the data after the public key decryption view results.

Demo:https://github.com/heavendong/encryptdemo

Android MD5 encryption, RSA encryption

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.