Computer Security - Lecture-03 Overview of Cryptography
Computer Security - Lecture-03 Overview of Cryptography
Compute Security
Lecture: 03
Overview of Cryptography
IIT, JU
Lecture-03 Overview of Cryptography
Slide 2 IIT, JU
What is Cryptography?
Ensuring the security of Electronic data is a vital issue for E-
commerce. The transmission of purchase information, credit card
numbers, and other transaction information must be secure to give
consumers and merchants the confidence they need to do business
over the Internet.
Encrypt Decrypt
Ciphertext Decrypted text/
Plaintext/Cleartext Plaintext
Happy Valentine’s Day Gzoox Uzkdmshmd’r Czx Happy Valentine’s Day
Slide 4 IIT, JU
Parts of a Cryptographic System:
Generally, all cryptographic processes have four basic
parts:
1. Plaintext
Slide 5 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 6 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
Cryptology:
Cryptography and cryptanalysis are often subsumed by the more
general term cryptology.
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 7 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 8 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.
Slide 9 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.
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
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 12 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
Slide 14
Figure: Locking and unlocking in asymmetric-key cryptosystemIIT, JU
Idea Behind Asymmetric-key Cryptography:
Asymmetric-key cryptography uses two separate keys: a private key and a public key.
Both sending and receiving entity have their own key pairs, where one key (usually public key) is used
to encrypt message and another key (usually private key) is used to decrypt message. In other words,
a message encrypted with a public key can be decrypted only with the corresponding private key.
Alice uses Bob’s public key to send encrypted message to Bob.
Bob uses his private key to decrypt message sent by Alice.
Slide 18 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.
Slide 19 IIT, JU
Symmetric-key Vs. Asymmetric-key Cryptography:
Key-point Symmetric-key Asymmetric-key
Invention More than 2000 years (at In the mid 1970’s
least in primitive form)
Key length This approach uses shorter This approach uses longer
keys keys
Slide 20 IIT, JU
Symmetric-key Vs. Asymmetric-key Cryptography:
Key-point Symmetric-key Asymmetric-key
Is distribution of key Not so easy, since both the Easy, because only the public
easy? sender and receiver key is to be distributed which is
posses the same key. open to all.
Slide 21 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?
Slide 22 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.
Slide 23 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.
Slide 24 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
Slide 25 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 26 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
Slide 27 IIT, JU
Why is cryptography important?
Communicating over the Internet without encryption is like broadcasting over the
radio.
Cryptography allows people to carry over the confidence found in the physical
world to the electronic world, thus allowing people to do business electronically
1. Data Integrity:
The receiver of a message should be able to check whether the message was
modified during transmission, either accidentally or deliberately. No one
should be able to substitute a false message for the original message, or for
parts of it.
It verifies that neither the purchase amount nor the goods bought are
changed or lost during transmission. Integrity also means the message has
not reached the recipient twice.
2. Authentication:
The receiver of a message should be able to verify its origin. No one should
be able to send a message Bob and pretend to be Alice (data origin
authentication). When initiating a communication, Alice and Bob should be
able to identify each other (entity authentication). Therefore, authentication
means to identify or verify that the senders of messages are genuine (who
they claim to be).
Slide 30 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
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 31 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
Slide 32 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.
How many keys do you need for communicating with a group of m persons?
Number of keys = (m(m-1))/2
Slide 33 IIT, JU
Cryptography Vs. Cryptanalysis:
Slide 34 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 36 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 37 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.
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 38 IIT, JU