Encryption encrypts data so that illegal users cannot obtain the correct data even if they have obtained the encrypted data. Therefore, data encryption can protect data and prevent attacks. The focus is on data security.
Identity Authentication is used to determine the authenticity of an identity. After the identity is confirmed, the system can grant different permissions according to different identities. The focus is on the authenticity of users. The two have different focuses.
The common encryption algorithms used in encryption are asymmetric encryption algorithms (Public Key and private key encryption algorithms)
Principles of Public Key and private key:
- A public key corresponds to a private key.
- The key pair and public key are disclosed. The private key is kept by the key holder (not disclosed ).
- If one of the keys is used to encrypt data, only the corresponding key can be decrypted.
- If one of the keys can be used for data decryption, the data must be encrypted by the corresponding key.
Asymmetric Key Cryptography is mainly used for public key encryption and public key authentication.
The process of public key encryption is different from that of public key authentication. I will explain in detail the differences between the two.
Public Key-based encryption process
For example, two users Alice and Bob, Alice want to send a piece of plain text to bob through the two-key encryption technology. Bob has a pair of public and private keys, the encryption and decryption process is as follows:
- Bob transfers his public key to Alice.
- Alice encrypted her message with Bob's public key and sent it to Bob.
- Bob uses his private key to decrypt Alice's message.
Public Key-based authentication process
Identity authentication and encryption are different. The main users identify the authenticity of users. Here, we can identify a user's private key as long as it is correct.
For Alice and Bob, Alice wants Bob to know that she is a real Alice, rather than a fake one. Therefore, Alice only needs to use public key cryptography to sign the file and send it to Bob, bob uses Alice's public key to decrypt the file. If the decryption succeeds, it proves that Alice's private key is correct and thus completes Alice's identity authentication. The authentication process is as follows:
- Alice uses her private key to encrypt the file and sign the file.
- Alice transfers the signed file to Bob.
- Bob decrypts the file with Alice's public key to verify the signature.
Reference
Http://www.cnblogs.com/4-312/p/3198185.html