First, public key encryption
Let's say I've looked for two numbers, one is 1, the other is 2. I like the number 2, I keep it, I don't tell you (the private key), and then I tell you that 1 is my public key.
I have a file that I can't let anyone else see, I'm using 1 encryption. Others found this file, but he did not know that 2 is the decryption of the private key ah, so he can't open, only I can use
The number 2, is my private key, to decrypt. So I can protect the data.
My good friend X encrypted the character A with my public key 1, encrypted it into B, and put it on the Internet. Someone else stole the file, but others can't, because nobody knows 2 is my private key,
I'm the only one who can decrypt it and get a after it's decrypted. In this way, we can transfer encrypted data.
Second, the private key signature
If I encrypt a piece of data with the private key (only I can encrypt it with the private key, because I know that 2 is my private key), all people see my content, because they know
The way my public key is 1, what is the use of this encryption?
But my good friend X said someone was impersonating me and sending him a letter. How to do it. I sent my letter, the content is C, with my private key 2, encrypted, encrypted content is D, to X, and then tell him
Decryption look is not C. He decrypted it with my public key 1 and found that it was c.
At this point, he would think that the data that can be decrypted with my public key must be encrypted with my private key. Only I knew I had the private key, so he could confirm that it was really my hair.
So we can confirm the sender's identity. This process is called a digital signature. Of course, the specific process is slightly more complicated. Use the private key to encrypt the data, which is the digital signature .
Summary: The public and private keys are paired, and they decrypt each other.
Public key encryption, private key decryption.
Private key digital signature, public key authentication.
Example
For example, there are two users Alice and Bob,alice want to send a piece of plaintext through two-key encryption technology to Bob,bob has a pair of public and private keys, then the process of encrypting decryption is as follows: Bob sends his public key to Alice. Alice encrypts her message with Bob's public key and sends it to Bob. Bob decrypts Alice's message with his private key.
The above procedure can be shown in the following illustration, Alice uses Bob's public key for encryption, and Bob decrypts his private key.
Examples and figures from the second edition of Basic applications and standards for cybersecurity
RSA Algorithm
RSA Public Key cryptography was developed in 1977 by Ron Rivest, Adi Shamirh and Lenadleman (Massachusetts Institute of America). RSA is named after the names of the three people who developed them. RSA is currently the most influential public-key encryption algorithm, it is able to resist all known password attacks so far, has been recommended by the ISO public key data Encryption standard. The RSA algorithm is based on a very simple number theory fact: it is easy to multiply two large primes, but it is extremely difficult to factorization the product at that time, so it is possible to expose the product as an encryption key.