PMIT-6204:: Cryptography & Steganography
PMIT-6204:: Cryptography & Steganography
for
3rd Semester of PMIT Program
Lecture File: 01
Overview of Cryptography
Prepared by:
Professor K M Akkas Ali
[email protected], [email protected]
Slide-2 IIT, JU
Lecture File-01
Overview of Cryptography
Topics to be Discussed
❖ To know the general idea behind
Encrypt Decrypt
Ciphertext Decrypted text/
Plaintext/Cleartext Plaintext
Happy Valentine’s Day Gzoox Uzkdmshmd’r Czx Happy Valentine’s Day
Slide 5 IIT, JU
Slide 6
White Board
Slide 7 IIT, JU
Basic Terminology Related to Cryptography
❖ Plaintext/ Cleartext:
It is the original message that is being protected.
❖ Encrypt:
To transform a plaintext into ciphertext.
❖ Decrypt:
To transform a ciphertext into plaintext.
Slide 8 IIT, JU
Basic Terminology Related to Cryptography
❖ Cryptanalysis:
It is the science of studying attacks against cryptographic
schemes. Successful attacks may, for example, recover the
plaintext (or parts of the plaintext) from ciphertext, substitute the
parts of the original message, or forge digital signatures.
❖ Key:
A key is a set of mathematical value, formula or process that the
cipher, as an algorithm, operates on. It determines how a
plaintext message is encrypted or decrypted. The key is the only
way to decipher the scrambled information.
A key is used to encrypt the message. Another or the same key is
used to decrypt the message. As the size of key, used to encrypt
a message, increases, so does the difficulty in deciphering the
message.
Slide 9 IIT, JU
Kinds of Cryptography
There are two main types of encryption:
1. Single key or secret key or symmetric-key cryptography
2. Public key or asymmetric-key cryptography
Slide 10 IIT, JU
Idea Behind Symmetric-key Cryptography:
This is an encryption system in which both sender and receiver
possess the same key for communication on the other direction.
Both parties can encrypt and decrypt messages with this same
key. The sender and receiver must have a shared key set up in
Slide 11 IIT, JU
Idea Behind Symmetric-key Cryptography:
Postal Analogy of Symmetric-key Cryptography:
In the symmetric-key cryptography, the same key is used to both
encrypt and decrypt message.
The problem with this method is how to give Bob a copy of the key
that Alice used.
Slide 12 IIT, JU
Idea Behind Symmetric-key Cryptography:
To create the ciphertext from the plaintext, Alice uses an
encryption algorithm and a shared secret key.
To create the plaintext from ciphertext, Bob uses a decryption
algorithm and the same secret key.
Merits:
Symmetric key algorithms are computationally less intensive than
asymmetric key algorithms. In practice, this means that a quality
asymmetric key algorithm is much slower than a quality symmetric
Demerits:
It can pose two problems:
1. The key must be delivered securely to the two parties involved.
2. If a business has 10 business vendors, it needs 10 different single
keys unique to each vendor. Key distribution for multiple keys can
be a hassle. Choosing, distributing, and storing keys without error
and without loss is difficult.
Slide 14 IIT, JU
Idea Behind Asymmetric-key Cryptography:
It is an encryption system in which two mathematically related keys are used for encoding
and decoding the message. Of the two keys, one is called public key that any one can
know. Another is called private key that only the owner knows.
Public key can encrypt information, whereas, the private key can decrypt it. The private
key is assigned to one designated owner, but the public key can be announced to the
world. It can be published in a newspaper, on a server, on a website, or via a service
provider so that anyone can encrypt with it.
Slide 20 IIT, JU
Modes of Usages of Asymmetric-key Cryptography:
Providing Authenticity of the Message Originator:
In this way of private-public key-pairs, data encrypted with the
private key can only be decrypted with the public key.
✔ Use asymmetric-key encryption for authentication.
❖ Here, data is encrypted by the sender using his/her
Slide 21 IIT, JU
Symmetric-key Vs. Asymmetric-key Cryptography:
Key-point Symmetric-key Asymmetric-key
Key length This approach uses shorter This approach uses longer
keys keys
Slide 22 IIT, JU
Symmetric-key Vs. Asymmetric-key Cryptography:
Key-point Symmetric-key Asymmetric-key
Is distribution of key Not so easy, since both Easy, because only the public
easy? the sender and receiver key is to be distributed which
posses the same key. is open to all.
Slide 23 IIT, JU
Symmetric-key Vs. Asymmetric-key Cryptography:
Key-point Symmetric-key Asymmetric-key
Does it support No, because both parties have Yes
non-repudiation the same key.
requirement?
Nature of In symmetric-key cryptography, But in asymmetric-key
plaintext and the plaintext and ciphertext are cryptography, the plaintext
ciphertext thought of as a combination of and ciphertext are numbers.
symbols (characters or bits).
Algorithm Symmetric-key cryptography is Asymmetric-key
needed based on substitution and/or cryptography is based on
permutation of symbols applying mathematical
(characters or bits). functions to numbers.
More secure? No, because both parties have Yes, since only one party
the same key for encryption and needs to know the private
decryption purposes. The key is key, and if a third party
not to be leaked to outsider and knows the public key, it does
should be changed often to not compromise the security
ensure security. of the message.
Speed of Faster, since it can be Relatively slower, since it
operation implemented easily in most takes time to compute.
hardware
Slide 24 IIT, JU
Three-pass Protocol:
Besides symmetric-key and asymmetric-key cryptography, there is
another protocol that one can use to send sensitive information across
an insecure network. This protocol is called three-pass protocol which
does not involve sending keys across the network.
An analogy can help explain the three-pass protocol:
❖ When Bob receives the box, he sends it back to Alice with a padlock of his own.
❖ After receiving the box, Alice removes her padlock and returns the box to Bob.
❖ Bob can now open the box because it has only his padlock on it.
Slide 25 IIT, JU
Common Cryptosystems:
Some widely used cryptosystems are described here briefly.
RSA Algorithm:
❖ It is the most commonly used public-key algorithm, although it is vulnerable to
attack.
❖ This algorithm lets you choose the size of your public key.
❖ The 512-bit keys are considered insecure or weak, but the 768-bit keys are
secure from everything but the National Security Administration (NSA).
❖ DES is the first private-key encryption system which is widely used commercially
Slide 26 IIT, JU
Common Cryptosystems:
3DES:
❖ Stronger version of DES called Tripple DES, uses three 56-bit key to encrypt
each block.
❖ The first key encrypts the data block, the second key decrypts the data block
and the third key encrypts the same data block again.
❖ It offers strong encryption using a 128-bit key to encrypt 64-bit blocks. This
system is widely used in older version of PGP (Pretty Good Privacy) system.
Slide 27 IIT, JU
Need for Both Cryptography:
There is a very important fact that is sometimes misunderstood:
❖ The advent of asymmetric-key cryptography does not eliminate the need for
symmetric-key cryptography.
Slide 28 IIT, JU
Merits and Demerits of Encryption:
The advantages of Cryptography are:
It hides the message and your privacy is safe.
No one would be able to know what it says unless there's a key to the code.
You can write what ever you want and how ever you want (any theme any
symbol for the code) to keep your code a secret.
Cryptography allows people to carry over the confidence found in the physical
world to the electronic world, thus allowing people to do business electronically
without worries of deceit and deception. Every day hundreds of thousands of
Slide 32 IIT, JU
Four security needs provided by Encryptions:
❖ Properly implemented encryption proves identity.
❑ When logging a username and password are provided.
o Both are unique keys.
❖ If this personal information is kept private and is encrypted, then in a perfect
world:
3. Non-repudiation:
❖ The sender should not be able to later deny that he/she sent a message. It is
a procedure that prevents sender and vendor in a transaction or
communication activity from later falsely denying that the transaction
occurred. Non-repudiation is like sending a certified letter with a return
receipt via postal system. Like a receipt accompanying the registered letter, a
digital signature accompanies the transfer of data, so, the originator cannot
deny having sent the message.
Slide 33 IIT, JU
Four security needs provided by Encryptions:
4. Privacy:
❖ Privacy is when the data transmission is kept private. It shields
communications from unauthorized viewing or access. For example, Rassel
might not want his wife or any other person to know what he is transacting,
nor does the vendor want to reveal the special deal he/she has made for that
particular customer.
Slide 34 IIT, JU
Key Distribution/ Exchange of Symmetric Key:
In symmetric-key cryptography, Alice and Bob use the same key for
communication on the other direction. This key must be protected from
access by others.
However, Alice may need to communicate with another person, say
David. Then she needs another secret key. The more keys Alice uses, the
more complexity may arise to handle those keys.
Furthermore, frequently key exchanges are usually desirable to limit the
How many keys do you need for communicating with a group of m persons?
❑ Number of keys = (m(m-1))/2
Slide 35 IIT, JU
Cryptography Vs. Cryptanalysis:
Slide 36 IIT, JU
Traditional Symmetric- Key Ciphers
Traditional symmetric-key ciphers can be classified into two broad categories:
1. Substitution Ciphers
A substitution cipher replaces one symbol with another. For example, we
can replace letter A with letter D, and letter T with letter Z. If the
symbols are digits, we can replace 3 with 7, 2 with 6.
2. Transposition Ciphers
A transposition cipher does not substitute one symbol for another,
instead it changes the location of the symbols.
A symbol in the first position of the plaintext may appear in the ninth
position of the ciphertext. A symbol in the eighth position of the
plaintext may appear in the first position of the ciphertext. For example,
the plaintext characters “hello” may be encrypted as “elhol”.
Slide 38 IIT, JU
Stream Ciphers
Stream cipher encrypts a single character or bit of plaintext at a time. It
also decrypts a single character or bit of ciphertext at a time.
Both the encryption and decryption are performed using the same key.
Example:
Plaintext : 10011011110100001
Keystream : 10101010101010101
Ciphertext : 00110001011110100 (by XORing each plaintext bit with corresponding keystream bit)
To decrypt this ciphertext, all we need to do is again XOR the ciphertext with the
keystream:
Ciphertext : 00110001011110100
Keystream : 10101010101010101
Plaintext (XOR) : 10011011110100001
Slide 39 IIT, JU
Block Ciphers
A symmetric-key modern block cipher encrypts an
n-bit block of plaintext or decrypts an n-bit block of ciphertext together
using the same secret key.
The common values of n are 64, 128, 256, or 512 bits.
❖ If the message has the fewer than n bits, padding must be added to
❖ If the message has more than n bits, it should be divided into n-bit
blocks and the appropriate padding must be added to the last block if
necessary.
Example:
Plaintext : The only thing we have to fear is fear itself
Plaintext blocks : Theonlyt hingweha vetofear isfearit selfXend (break the plaintext into 8-character block)
Ciphertext blocks : tylnoehT ahewgnih raefotev tiraefsi dneXfles (just reverse each plaintext block)
Ciphertext : tylnoehTahewgnihraefotevtiraefsidneXfles
Slide 40 IIT, JU
Slide-41
Thank you…
Have a question?