Chapter 3
Chapter 3
1. Plaintext
Let's start with the most basic encryption term, which is simple but just as important as the
others: plaintext is an unencrypted, readable, plain message that anyone can read.
2. Ciphertext
Ciphertext is the result of the encryption process. The encrypted plaintext appears as apparently
random strings of characters, rendering them useless. A cipher refers to the encryption algorithm
that transforms the plaintext, hence the term ciphertext.
3. Encryption
Encryption is the process of applying a mathematical function to a file that renders its contents
unreadable and inaccessible—unless you have the decryption key.
4. Decryption
If encryption locks the file, then decryption reverses the process, turning ciphertext back to
plaintext. Decryption requires two elements: the correct password and the corresponding
decryption algorithm.
5. Keys
The encryption process requires a cryptographic key that tells the algorithm how to transform
the plaintext into ciphertext. Kerckhoffs's principle states that "only secrecy of the key provides
security," while Shannon's maxim continues "the enemy knows the system."
These two statements influence the role of encryption and keys within that.
Keeping the details of an entire encryption algorithm secret is extremely difficult; keeping a
much smaller key secret is easier. The key locks and unlocks the algorithm, allowing the
encryption or decryption process to function.
Is a Key a Password?
No. Well, at least not entirely. Key creation is a result of using an algorithm, whereas a password
is usually a user choice. The confusion arises as we rarely specifically interact with a
cryptographic key, whereas passwords are part of daily life.
Passwords are at times part of the key creation process. A user enters their super-strong password
using all manner of characters and symbols, and the algorithm generates a key using their input.
6. Hash
When a website encrypts your password, it uses an encryption algorithm to convert your
plaintext password to a hash. A hash is different from encryption in that once the data is hashed,
it cannot be unhashed. Or rather, it is extremely difficult.
Hashing is really useful when you need to verify something's authenticity, but not have it read
back. In this, password hashing offers protection against brute-force attacks (where the attacker
tries every possible password combination).
You might have even heard of some of the common hashing algorithms, such as MD5, SHA,
SHA-1, and SHA-2. Some are stronger than others, while some, such as MD5, are outright
vulnerable. For instance, if you head to the site MD5 Online, you'll note they have
1,154,870,291,783 words in their MD5 hash database. Go ahead, give it a try.
As you see, a hashed password doesn't automatically mean it is secure (depending on the
password you chose, of course). But there are additional encryption functions that boost security.
7. Salt
When passwords are part of key creation, the encryption process requires additional security
steps. One of those steps is salting the passwords. At a basic level, a salt adds random data to a
one-way hash function. Let's examine what that means using an example.
There are two users with the exact same password: hunter2.
Someone hacks the password database, and they check this hash; each account with the
corresponding hash is immediately vulnerable.
This time, we use an individual salt, adding a random data value to each user password:
Quickly compare the hashes for the same passwords with and without the (extremely basic) salt:
You see that the addition of the salt sufficiently randomizes the hash value that your password
remains (almost) completely safe during a breach. And better yet, the password still links to your
username, so there is no database confusion when you sign into the site or service.
In modern computing, there are two primary encryption algorithm types: symmetric and
asymmetric. They both encrypt data but function in a slightly different manner.
Symmetric algorithm: Uses the same key for both encryption and decryption. Both
parties must agree on the algorithm key before commencing communication.
Asymmetric algorithm: Uses two different keys: a public key and a private key. This
enables secure encryption while communicating without previously establishing a mutual
algorithm. This is also known as public-key cryptology (see the following section).
The overwhelming majority of online services we use in our daily lives implement some form of
public-key cryptology.
An asymmetric algorithm uses two keys: a public key and a private key. The public key can be
sent to other people, while the private key is only known by the owner. So what's the purpose of
this?
Well, anyone with the intended recipient's public key can encrypt a private message for them,
while the recipient can only read the contents of that message provided they have access to the
paired private key. Check out the below image for more clarity.
Public and private keys also play an essential role in digital signatures, whereby a sender can
sign their message with their private encryption key. Those with the public key can then verify
the message, safe in the knowledge that the original message came from the sender's private key.
A key pair is the mathematically linked public and private key generated by an encryption
algorithm.
One of the biggest encryption buzzwords is that of end-to-end encryption. Social messaging
platform service WhatsApp began offering its users end-to-end encryption (E2EE) in 2016,
making sure their messages are private at all times.
In the context of a messaging service, EE2E means that once you hit the send button, the
encryption remains in place until the recipient receives the messages. What is happening here?
Well, this means that the private key used for encoding and decoding your messages never leaves
your device, in turn ensuring that no one but you can send messages using your moniker.
WhatsApp isn't the first or even the only messaging service to offer end-to-end encryption.
However, it moved the idea of mobile message encryption further into the mainstream—much to
the ire of government agencies around the world.
11. Backdoor
Encryption is excellent and will keep your data and accounts secure—unless there is
a backdoor. So, what is an encryption backdoor?
No matter how secure the encryption is, someone can negate the security if someone inserts a
backdoor in the code. Encryption backdoors are a constant talking point for governments
worldwide, becoming an especially hot topic after any terrorist attack
3.3.Cipher Techniques
Both Substitution cipher technique and Transposition cipher technique are the types of
Traditional cipher which are used to convert the plain text into cipher text.
3.3.1. SUBSTITUTION TECHNIQUES
Note that the alphabet is wrapped around, so that the letter following Z is A. We can define the
transformation by listing all possibilities, as follows:
plain: a b c d e f g h i j k l m n o p q r s t u v w x y z
cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Then the algorithm can be expressed as follows. For each plaintext letter, substitute the
ciphertext letter C
All the techniques examined so far involve the substitution of a ciphertext symbol for a plaintext
symbol. A very different kind of mapping is achieved by performing some sort of permutation on
the plaintext letters. This technique is referred to as a transposition cipher.
The simplest such cipher is the rail fence technique, in which the plaintext is written down as a
sequence of diagonals and then read off as a sequence of rows. For example, to encipher the
message ―meet me after the toga party‖ with a rail fence of depth 2, we write the following:
m e m a t r h t g p r y
e t e f e t e o a a t
The encrypted message is
MEMATRHTGPRYETEFETEOAAT
Cryptanalysis is the study of analyzing and breaking cryptographic algorithms and encrypted
data. Techniques include brute force attacks, frequency analysis, and linear cryptanalysis.
Cryptanalysis helps identify weaknesses in cryptographic systems.
3.6.2.1 Diffie-Hellman
The Diffie-Hellman key exchange allows two parties to securely share a secret key over a public
channel, enabling encrypted communication.
3.6.3.2.3 RIPEMD
RIPEMD (RACE Integrity Primitives Evaluation Message Digest) is a hash function developed
as an alternative to MD5 and SHA, with improved security.
3.6.4.1.2 Certification
Certification binds a public key to an entity using a digital certificate, signed by a CA.
3.6.4.1.3 Key Distribution
Key distribution ensures secure delivery of cryptographic keys to authorized users.
Prior to 1970, all cryptosystems employed symmetric key encryption. Even today, its relevance
is very high and it is being used extensively in many cryptosystems. It is very unlikely that this
encryption will fade away, as it has certain advantages over asymmetric key encryption.
The salient features of cryptosystem based on symmetric key encryption are −
Persons using symmetric key encryption must share a common key prior to exchange of
information.
Keys are recommended to be changed regularly to prevent any attack on the system.
A robust mechanism needs to exist to exchange the key between the communicating
parties. As keys are required to be changed regularly, this mechanism becomes expensive
and cumbersome.
In a group of n people, to enable two-party communication between any two persons, the
number of keys required for group is n × (n – 1)/2.
Length of Key (number of bits) in this encryption is smaller and hence, process of
encryption-decryption is faster than asymmetric key encryption.
Processing power of computer system required to run symmetric algorithm is less.
Due to the advantages and disadvantage of both the systems, symmetric key and public-key
cryptosystems are often used together in the practical information security systems.