Mobile Internet applications now generally use the user registration login mechanism to enhance user stickiness. So for security design, how should the user's password be transmitted? How to save in the cloud? This question I thought for a long time, summed up the following some ideas, mainly related to the use of irreversible encryption principles.
The purpose of the user's login is to verify that the user attempting to log on is the same user as the user who originally registered.
Assuming that the user's registration/login process is performed in a completely secure environment, such as when you develop a standalone application on your own home computer, you can easily design a user authentication system to prevent your child from using it: Set a password to write the password you entered directly into your app's data, which is quite a sign-up ; Use when you enter the password again, if the same pass, otherwise do not pass, this is equivalent to login. The above system does not need to involve any encryption technology, just to compare the password.
However, if you further consider that the entire process may be carried out in an unsafe environment, such as this computer is not exclusive to you, and is not placed in your home, such as in the cloud, such as your login process operation is on the mobile phone client, further, your phone may be lost or be London, Your phone and the cloud computer before the transmission may be hacked, ...
Think in this environment, how can you guarantee that your login process will not be disguised by other people with ulterior motives?
The following is the delivery of the password and the information derived from it (I call it trust information) during the registration and login process:
Registered:
Mobile App Cloud Server
Persistent save with a password, transfer, and so on
Login:
Mobile App Cloud Server
Password-and transmission--comparison with persisted information
Because of the insecurity of the delivery process, the more steps are passed, the less the cost of information disclosure and information tampering. In order to ensure that the trust information is not disclosed or tampered with, it should be ensured that the transfer process of trust information is irreversible and deterministic, such as a hash encryption algorithm (e.g. md5,sha1,sha256) for this purpose.
The irreversible reason is that the upstream information (such as a password) cannot be inferred from downstream information, and the determined one ensures that the same upstream information is obtained with the same downstream result through the same algorithm operation, so that the cloud can compare the results of both sides to infer that the original upstream information information (such as the password) is the same, To achieve the user authentication effect.
The above is a bit abstract, not very intuitive, then I would like to say, explain how specifically, how to encrypt the password in each link (such as transfer/save)?
For example, the user entered a password at the time of registration, you can do a hash encryption, then network transmission, the cloud server received, then do a hash encryption, and then save it. The process of logging in is similar to the information that a cloud server Gets or uses after several (here is 2) hash encryption results.
In contrast, there are many applications that are only once hashed encrypted and then saved directly to the cloud server. What is the problem with this simple approach?
This approach appears to use irreversible encryption, but the problem is that it does not identify the complete information-passing link that may be present in the installation leak, and adds the necessary hashing steps. In particular, if the data in the cloud is compromised, although it is not possible to derive the password directly, it can be used for a fake mobile phone application to forge the login process.
To summarize:
Irreversible cryptographic processing uses scenarios where trust information is passed to a low-trust domain by a high-trust domain. If there are multiple levels of this scenario in a system, you should use multiple irreversible encryption processing.
Note:
1) The above mentioned irreversible encryption process does not mean that only one hash encryption algorithm iteration, in fact, in order to increase the strength of the algorithm, it is sometimes possible to use a lot of hash encryption algorithm iteration.
2) in irreversible encryption processing, often also need to add salt value, in order to resist the Rainbow table attack, here do not elaborate.
Talking about the application principle of non-reversible encryption of user registration and login security for mobile Internet application