Encryption and decryption of information

Encryption and decryption of information

  • There are two encryption information
    1. Symmetric encryption: the same key to encrypt and decrypt the information called symmetric encryption.
      • Usage scenarios: A and B, and stores a common key agreement.
        • A -> B: A key used to encrypt the data obtained after the encrypted message is sent to B, B using the key to decrypt the encrypted information to obtain the original information.
        • B -> A: B using the obtained encryption key to encrypt data sent to the data A, A using the key to decrypt the encrypted data to obtain the original data.
      • Advantages: fast speed encryption and decryption.
      • Disadvantages:
        1. Relatively insecure, because the two sides AB encryption and decryption using the same key, any party to key compromise, the entire encryption and decryption process is exposed.
        2. You must use different keys when communicating with parties, key management difficulties caused by multiple keys. If the communication with the A and C when A and B are communicating with a key, the encrypted C if A and B to obtain the communication information can be decrypted using the key, resulting in leakage of information between A and B .
    2. Asymmetric encryption: encryption and decryption using a different key. If you are using a public key encryption, then it must be private key to decrypt. If you are using a private key encryption, public key must be decrypted. The need to understand public, private two concepts.
      • Public: supplying the key used by others, the use of public key encryption process is called encryption information, mainly for the purpose of preventing leakage of information during transmission. Because the private key to decrypt only for its own.
      • Private: supplying own key used to encrypt the information using the private key of the signature process is called, the main purpose is to ensure that the information is sent by themselves. Because the recipient holding a public key can only provide their own undoing your information using the private key encryption.
      • Usage scenarios: B generates a public and private key, and sends the public key to A.
        • A -> B: A using B's public key to encrypt information supplied to a B, B decrypts using his private key to obtain the original information content. In this process, although to ensure that the information is not decrypted by other people get, because B has only the private key, but other people can use this information to send the public key B.
        • B -> A: B using its own private key to encrypt information sent to the A, A B using a public key provided to decrypt retrieve the original information content. In this process, although to ensure that the sender information is B, but can not ensure that this information is only A one knows, because other people can also use this public key to decrypt the information sent to B of A.
      • Advantages: relatively safe, make sure the transfer A to B to decrypt the information will not be passed to other people as well as the message A is B himself.
      • Disadvantages:
        1. A message can be sent to other people to get.
        2. B can not determine who the message must be sent A.
        3. Relatively low efficiency, with respect to the encryption and decryption process is symmetric encryption slower.
    3. The asymmetric two previous drawbacks can actually be solved by the secondary encryption, but will increase the time cost, the following specific process:
      • Usage scenarios: A generates a public and private key, and sends the public key to B, B also generates a public and private key, the public key sent to A, so that, A and B's private key held by A public key, private key held by B of a and B of the public.
        • A -> B: A first use B's public key to encrypt information, to ensure that the messages will not be available to other people, and then re-encrypt the information using their own private key to encrypt A, to ensure that the sender is A I . B receives the encrypted message, before using the public key provided by A decrypts the information obtained using the public key encryption B, then B using its own private key to decrypt the secondary finally obtain the original information.
        • B -> A: B to A using the public key to encrypt information, to ensure that the messages will not be available to other people, and then re-encrypt the information using its own private key to encrypt B, B to ensure that the sender is himself . A receives the encrypted message, using the public key B first decrypts provided, the information obtained using A public key encryption, re-use A secondary own private key to decrypt finally obtain the original information.
      • Summary: Through the above steps to ensure that the information not be available to other people in the process of A and B as well as the exchange of information in each other's status is not an imposter.
    4. During actual use asymmetric encryption, a relatively large amount of information is often directly asymmetric encryption time consuming great cost. Thus typically take the form of using the MD5 / SHA-1 like the digital signature to verify the validity of information of the original information without encryption, digital signature object of the plaintext data only to prevent tampering. Used to verify the digital signature plaintext data were transmitted to the other party along with the public key to encrypt plaintext data. If you do not want to send plaintext is viewed by others, you can even plaintext message is encrypted using a symmetric encryption algorithm, and then use the public key encryption key provided by the other party's public key and the encrypted digital signature is symmetrical belt encrypted information sent.

Guess you like

Origin www.cnblogs.com/soundofcolors/p/11520958.html