liveBook · Manning

Public key

As explained in Hacking Cryptography

The public key is the openly distributable member of an asymmetric key pair used for operations such as encryption or signature verification.

A public key is the shareable half of an asymmetric keypair. It may be sent across an insecure channel or published freely; security depends on keeping the matching private key secret. For encryption, anyone can encrypt plaintext to a recipient’s public key, but only the holder of the corresponding private key can decrypt the ciphertext. section 8.1

Think of the public key as a lock that can be handed to anyone, while the private key is the unique physical key retained by its owner. Sharing the lock does not let an observer open a box protected by it. section 8.1

Public keys serve different asymmetric operations:

  • Encrypting to a recipient: the recipient’s public key transforms plaintext into ciphertext; the paired private key decrypts it. section 8.1 section 8.3.2
  • Establishing a shared secret in Diffie–Hellman: participants exchange public keys and combine the other party’s public key with their own private key. section 8.3.1
  • Verifying a digital signature: a verifier uses the relevant public key to obtain a yes/no result for a message and signature, without gaining the ability to create signatures. section 9.1

RSA public key

In RSA, a public key is the pair (n, e). With published values n = 140311 and e = 17653, a sender encrypts m = 1337 as c = m^e mod n = 133682. The private exponent d, not the public key, is needed to recover the plaintext. section 8.3.2

A public key is not assumed reversible: classical systems rely on a trapdoor one-way function. Diffie–Hellman public keys derive from discrete-logarithm settings, while RSA public keys expose a modulus and exponent whose security rests on the difficulty of integer factorization. RSA deployments also require probabilistic padding rather than deterministic textbook encryption. section 8.3.1 section 8.5

Figure 8.2 Alice and Bob communicating using asymmetric encryption
figure

Trace the basic encryption flow: a sender receives the public key, encrypts to it, and the recipient alone applies the corresponding private key to decrypt. section 8.1

How Hacking Cryptography covers it

How deep it goes
Defines keypair roles and works through Diffie–Hellman and RSA calculations, while deferring the proof that RSA decryption works.
Examples
Uses a lock-and-key analogy, an Alice-and-Bob encryption flow, a modulo-13 Diffie–Hellman exchange, and numerical RSA encryption.
What you can do after
Evaluate/understand which asymmetric operation exposes a public key and which matching private-key operation remains secret.
How it connects
Connects asymmetric cryptography with private keys, Diffie–Hellman key exchange, RSA, digital signatures, discrete logarithms, and integer factorization.

Also explained in

Compare how 8 books explain public key →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.