Problem background
Sensitive information in the system, such as account balance, must be protected against tampering.
How can we guarantee it from the procedural perspective?
Analysis
Uses asymmetric encryption/decryption algorithms. The principles are as follows:
1. The website generates a pair of public keys and keys, which must be used in pairs.
2. The public key is published to the public, and the private key is saved by itself, so privacy must be ensured. The absence of private keys is a prerequisite for the effectiveness of this system.
3. Only the ciphertext generated by using the private key can be opened with the published public key. (Generally used for signature and anti-denial)
4. We adopt private key encryption and open the public key, which may be required for data interaction in the future.
5. flexible use of various tips can further improve security.
The following scheme is only a framework scheme and needs to be further enriched in actual implementation. 1. The website generates private key and public key pair. 2. When you need to save (or update) the balance, use the private key to encrypt the balance and obtain the ciphertext. 3. The website only saves the ciphertext. 4. When you need to read the balance, read the ciphertext and decrypt it with the public key to obtain the balance array. Advantage: the asymmetric encryption system greatly improves the system security. Disadvantages: system security depends on the privacy of the key. You can use keystore (protect the private key by password) and physical certificate (insert the certificate U disk or card on the server, which may cause performance bottlenecks, you can specify a few more policies), physical Encryptors (the best effect, high costs, easy to form performance bottlenecks), and other methods to further strengthen. Encryption and decryption algorithms bring about extra computing work, but they are almost negligible. Note the following tips: 1. Use the Digest algorithm to further confirm that the data has not been tampered.
2. Multiple asymmetric encryption algorithms can be used in combination. 3. Protect the privacy of program algorithms to the maximum extent. Do not disclose program logic to prevent program decompilation.
How to protect sensitive information from tampering