bastion

Introduction to Cryptography

Build this skill

Identify the plaintext, ciphertext and key in a scenario, and decide whether a security need calls for confidentiality, integrity or authenticity.

A medicine order that only two parties can read

Mrs. Lata Gokhale is sitting in a café in Kothrud, ordering her monthly diabetes tablets on the Tulsi Health app over the café's free Wi-Fi. Her order holds her name, her address and the name of her medicine. Anyone else on that Wi-Fi with the right free software could copy everything her phone sends, yet what they would see is a meaningless jumble of letters and symbols. Only the Tulsi Health server can turn that jumble back into her order. The science of scrambling information so that only the right people can read or trust it is called cryptography, from Greek words meaning "hidden writing", and it quietly protects almost everything you do online.

Tulsi Health app Metformin 500 2 strips Gokhale Wada Kothrud, Pune Place order Mrs. Gokhale's phone plaintext: readable Encrypt with a key 9fQ2#kL0x!vR7wpZ+e4T ciphertext: what travels over the café Wi-Fi Café Wi-Fi router Snooper on the Wi-Fi copies it, reads only gibberish Decrypt with the key Metformin 500 2 strips ✓ Tulsi Health server

The readable order exists only at the two ends. Everything in between, including the café Wi-Fi and the snooper on it, sees only scrambled text.

Plaintext, ciphertext and the two directions

Cryptography has a small set of words, and once you know them every later idea becomes easier. The readable message, such as "Metformin 500, 2 strips", is called plaintext. It does not have to be text: a photo of a prescription, a spreadsheet of invoices or a voice call can all be plaintext, because the word simply means "the original, understandable data". The scrambled version that travels over the network or sits on a disk is called ciphertext. A cipher is the method, a fixed recipe of steps, that turns one into the other.

Turning plaintext into ciphertext is encryption. Turning ciphertext back into plaintext is decryption. The two are the same recipe run forwards and backwards, a little like tying and untying a particular knot. Encryption happens on Mrs. Gokhale's phone just before the order leaves it, and decryption happens on the Tulsi Health server just after the order arrives. Between those two moments, the data is ciphertext, and ciphertext is safe to lose: a copy in the wrong hands is useless without the means to decrypt it.

Plaintextthe readable orderCiphertexttravels, gets storeddecryptPlaintextreadable againBoth steps need the key.

Only the middle stage is exposed to the outside world. Whoever holds the key can move between the two ends; everyone else is stuck in the middle.

The key is the real secret

If everybody knew the recipe, could everybody decrypt? This is where the most important word comes in. A cryptographic key is a secret value, usually a long string of numbers, that the cipher mixes into its work. The same recipe with a different key produces completely different ciphertext, and decrypting with the wrong key produces only more gibberish. So the recipe can be public, and in modern cryptography it always is, while the key alone stays secret.

Think of the number lock on a college hostel trunk. Every shop sells the same model, and anyone can study how it works, yet your trunk stays shut because only you know the three-digit combination. The design of the lock is not the secret; the combination is. Modern ciphers follow the same rule. Their designs are published and studied by experts around the world for years, which is how weaknesses get found and fixed. A cipher that is safe only while its design stays hidden is fragile, because designs leak, while a fresh key can be made in a second if an old one is exposed.

This rule also tells you where cryptography usually breaks in real life. Attackers rarely beat a well-designed modern cipher head-on. They go after the key instead: a key written in a file next to the data, a key that is too short and can be guessed, or a key stolen from a device that was already infected. Protecting keys, keeping them long and random, storing them away from the data they protect, and replacing them when someone who knew them leaves, is most of the practical work.

Try naming the parts in a few Tulsi Health situations. Each round asks you to point at one piece of the picture: the plaintext, the ciphertext, or the key that really protects it.

What cryptography is for

Hiding a message is only one job. Cryptography is used for three main purposes, and it helps to keep them apart because each one answers a different worry. Confidentiality means keeping data secret from people who should not read it: Mrs. Gokhale's order on café Wi-Fi, or prescriptions stored in the app's database. Integrity means being able to detect if data has been changed, by accident or on purpose: an invoice that left the office at ₹4,500 and arrived at ₹45,000. Authenticity means being able to check who really sent something: a MedLedger update that genuinely came from Rathi Softech and not from someone pretending to be them.

ConfidentialityOnly the right people can read itExample: a prescription on caféWi-FiWorry: someone is listeningIntegrityAny change can be detectedExample: an invoice amountWorry: someone altered itAuthenticityThe sender can be checkedExample: a software updateWorry: someone is pretending

One message can need all three. A software update should not be readable by rivals, should not be altered on the way, and must really come from the vendor.

A related purpose, sometimes listed separately, is non-repudiation: making it hard for a sender to deny later that they sent something, much like a signature on a cheque. Different tools serve different purposes. Encryption mainly gives confidentiality, while other cryptographic tools exist mainly to detect changes and to prove who sent something. Asking "which of the three do we need here?" is the first step in choosing the right tool.

Sort the Tulsi Health needs below by the main purpose each one is about. Some sound alike, so ask yourself what the worry is: someone reading, someone changing, or someone pretending.

What encryption cannot do

Cryptography is powerful, but it protects data only in certain places and only against certain problems. It protects data while it travels, called data in transit, and while it sits stored on a disk or in the cloud, called data at rest. It does not protect data while it is being used on a device, because the plaintext has to be there for the person to read it. If Mrs. Gokhale's phone were infected with spying malware, the malware would see her order before encryption ever happened.

Encryption helps againstSnoopers on Wi-Fi or the internetA stolen laptop or lost phoneA copied backup or databaseCurious staff at a cloud companyEncryption does not stopMalware already on the deviceA stolen or guessed keyA user tricked into sharing dataDeleting or locking the data

Encryption makes stolen copies useless. It does nothing about a thief who already holds the key or sits on the device where the data is read.

Encryption also cannot stop someone from deleting data or scrambling it with their own key, which is exactly what ransomware does. And it cannot help when a person is tricked into handing over information directly. That is why cryptography is one layer among several at Tulsi Health, alongside updated devices, strong logins, careful staff and backups. Within its own job, though, it is remarkably strong: with a long random key kept safe, the ciphertext Mrs. Gokhale's phone sends cannot be read by anyone on that café Wi-Fi, however much computing power they have.

Follow your curiosity.

↑ ↓ to explore · Enter to open · Escape to close