It is the last working day of the month, and you are paying a supplier from your bank's mobile app on the Wi-Fi of a tea stall in Mirpur. You tap Pay, and a second later the screen says Done. In that second your request crossed the stall's router, a provider's network and half a dozen machines you will never see. Three questions had to be answered on the way, and a firewall cannot answer them. Could anyone read the request? Could anyone change 5,000 to 50,000 unnoticed? And is whoever replied really your bank, and will it be able to prove later, in front of an auditor, who asked for the payment?
Four tools answer those questions. A key pair lets two strangers share a secret. A hash gives any piece of data a fingerprint. A digital signature ties a message to the person who sent it. A certificate ties a public key to a name. In Networking you met each of them in a paragraph. This chapter builds all four from the inside, with real numbers computed by a program, not copied from a book.
By the end you will be able to make an RSA key pair from two small primes and use it by hand, run a Diffie-Hellman exchange and show how a man in the middle breaks it and how to stop him, and say what a hash promises and why its collision bound is 2^(n/2). You will keep hashing, encryption and encoding apart, build an HMAC, store passwords as a careful bank does, explain what a digital signature gives and what it does not, and read a certificate chain from the server up to the root.
We go in nine parts, from easy to hard: two keys, RSA, ElGamal and elliptic curves, Diffie-Hellman, hash functions, MAC and HMAC, passwords, digital signatures, and certificates with the PKI behind them.