How does public-key encryption work?

Public-key encryption uses a linked pair of keys: a public key anyone can use to lock a message, and a private key that only its owner holds to unlock it.

AI-drafted from web search results, then checked by a second, independent AI that read 5 of its 6 cited pages in full and found the thread supported. No person has reviewed it.

0 views
Circular diagram with three labeled boxes: plaintext on the left, ciphertext on the right. An orange arrow labeled 'public key' goes from plaintext to ciphertext, and a blue arrow labeled 'private key' returns from ciphertext to plaintext. Each key is shown as a key icon.
A diagram of an asymmetric cryptographic system, where a public key encrypts plaintext into ciphertext and a private key decrypts it back. Image: Bananen 🍌︎ falter 🦋︎, CC0, via Wikimedia Commons. Chosen automatically; not checked by a person.
Sourced

The short answer

Public-key cryptography encrypts or signs data with two different keys. One, the public key, is made available to anyone. The other, the private key, stays secret. Data encrypted with the public key can only be decrypted with the private key, which is why the method is also called asymmetric cryptography. It is widely used, especially in TLS/SSL, which makes HTTPS possible. [1]

Or ask in your own AI
Sourced

Sending a message step by step

Each person first generates a key pair. The Open University's explanation notes that the program usually asks for random input, such as keyboard typing or mouse movement, so that nobody else can recreate the keys. The two people then swap public keys, which can be sent by email or posted on a key server. [2]

To send a message, the sender uses the recipient's public key to turn readable plaintext into scrambled ciphertext. Only the recipient's matching private key can restore the original. In the standard example, Bob asks Alice for her public key, encrypts with it, and sends the result. Alice decrypts with her private key. Even the sender cannot read the encrypted message afterward. [3] [4]

Or ask in your own AI
Sourced

Why an eavesdropper is stuck

An eavesdropper, usually called Eve, may hold both the ciphertext and the public key, but that does not help her. The public key cannot undo what it did. The keys are related, yet the value of one cannot easily be worked out from the other, so a leaked public key does not reveal the private key. Eve would have to steal the private key or try brute force, which the Open University source says could take billions of years. [2]

Or ask in your own AI
Sourced

The formal definition

Cryptography textbooks describe a public-key scheme as three algorithms. A key generation algorithm produces a public and a private key. An encryption algorithm takes the public key and a message and outputs a ciphertext. A decryption algorithm takes the private key and the ciphertext and returns the message. Correctness means that decrypting an encrypted message always returns the original. In one textbook's definition, encryption is randomized and decryption is deterministic. [5] [6]

Or ask in your own AI
Sourced

Strengths and trade-offs

The main advantage is that no secret key has to be shared in advance. Users exchange only public keys, which sidesteps the key distribution problem of symmetric encryption. The costs are that public-key methods are generally far slower than symmetric ones, and traditional techniques need much longer keys for the same protection. The Open University source adds that a newer type of public-key cryptography, elliptic-curve cryptography, is introduced to address this, though the excerpt available here is cut off before explaining how. [2]

Or ask in your own AI

Sources

  1. How Does Public Key Encryption Work? | Public Key Cryptography and SSL (cloudflare.com) Found by source search. Not checked by a person.
  2. 1.4 Asymmetric or public key cryptography (open.edu) Found by source search. Not checked by a person.
  3. What Is Public Key Encryption? (ibm.com) Found by source search. Not checked by a person.
  4. Encryption (mirror.cpsc.ucalgary.ca) Found by source search. Not checked by a person.
  5. 10  Key Exchange and Public-key Encryption – The Structure of Secure Systems (securitybook.eecs.berkeley.edu) Found by source search. Not checked by a person.
  6. Public-Key Encryption - The Joy of Cryptography (joyofcryptography.com) Found by source search. Not checked by a person.

Questions to follow next

  • How do digital signatures use the private key?
    Or ask in your own AI
  • Why is public-key encryption slower than symmetric encryption, and how do HTTPS connections handle that?
    Or ask in your own AI
  • What mathematical problems make it hard to work out a private key from a public key?
    Or ask in your own AI

Keep going