Introduction to Cryptography:
When data is stored on a computer, it can be protected using physical methods
(like locking the room) or logical methods (like setting a password). But when we
send data to someone else (like through the internet), these methods don’t work.
To secure data during transmission, cryptography is used. It transforms the
original data (called plaintext) into an unreadable form (called ciphertext). Only
the right person, who has the key, can change the code back into the real
message. The main goal of cryptography is to protect information and
communication from unauthorized access.
Objectives of Cryptography:
i. Confidentiality: Keeps information secret. Only the right people can see it. Stops
others from reading private data.
ii. Integrity: Makes sure data is not changed or damaged. The message stays the
same from sender to receiver.
iii. Authentication: Checks if the person is real or not. Confirms the identity of the
sender or receiver.
Example: On LMS, when you enter your username and password, the system
checks if you are a real user. If your name is in the server, it gives access. If not,
you can’t enter.
iv Non-repudiation: Stops a person from denying that they sent a message or did
an action. Non-repudiation proves that the student did send it.
Non-repudiation means proof is there, so no one can deny it.
Example: A teacher gives a prize to the top student. Later, the teacher cannot say,
“I never gave the prize”. A student sends an assignment to the teacher. Later, the
student says, “I never sent it”
Authorization
Important point Authorization
Gives permission to use certain data or resources. It controls what a person can or
cannot do. Example: A student can see their own grades, but not change them.
Terminologies in Cryptography:
[Link] The original message that we can read and understand. "Hello"
[Link] The secret or coded message that we cannot understand."Xh3@9"
[Link] Changing the readable message (plaintext) into secret code
(ciphertext).
[Link] Changing the secret code (ciphertext) back into the original message
(plaintext).
[Link] A special code (made of bits) used to lock (encrypt) or unlock (decrypt) a
message. Example: Plaintext + Key = Ciphertext
[Link] The study or method of breaking secret codes without having the
key. Also called code-breaking.
[Link] A set of rules or steps used to do encryption or decryption.
Like a recipe followed to lock or unlock a message.
Types of Cryptography:
1. Symmetric Key Cryptography
In this type, the same key is used by both the sender and the receiver to lock
(encrypt) and unlock (decrypt) the message.
The sender uses the key to change the message into secret code.
The receiver uses the same key to change it back to the original message.
One key does both jobs — encrypting and decrypting.
So, it is called “symmetric” (same on both sides).
Example:
Imagine a key named A1B2C3.
The sender has a copy of this key.
The receiver also has the same key (a copy of A1B2C3).
They both use their copy to encrypt and decrypt the message.
So both sender and receiver have their own copy of it.
Advantages: 1. Works very fast
[Link] for sending large amounts of data
Disadvantages:
Less secure, because if someone steals the key, they can read the message.
Both sender and receiver must share the key secretly, which can be risky.
if there are: 10 people → 45 keys needed
100 people → 4950 keys needed
This formula: N(N-1)/2
is used to calculate the number of unique key pairs in symmetric key systems.
Problem:
As the number of people increases, the number of keys increases a lot, which
makes key management very hard. This is called the Key Distribution Problem in
symmetric cryptography.
Asymmetric Key Cryptography
Also called Public Key Cryptography
In this method, two different keys are used:
1. Public Key – This is shared with everyone.
2. Private Key – This is kept secret and only known to the owner.
These keys are a pair: they are related but not the same.
Whatever one key does, only the other key can undo it.
If someone wants to send you a secret message, they use your public key
to encrypt it.
Once encrypted, only your private key can open (decrypt) it.
So, even though the public key is shared, no one else can read the message
without your private key.
🔑 Public Key → Used for encrypting (locking the message)
🔒 Private Key → Used for decrypting (unlocking the message)
📬 You can share your public key with anyone, but your private key is never
shared
Example: Let’s say: You want to send a message to your friend. Your friend gives
you their public key. You use that to encrypt the message. Only your friend can
read it using their private key. Even you can’t read it again, because it's now
locked with their public key.
Key – Example: Some examples of encryption algorithms that use keys:
DES (Data Encryption Standard)
AES (Advanced Encryption Standard)
RC4, Blowfish
These are algorithms that use keys for encrypting and decrypting data.