BCY402 ECS Module-5 Notes - 3973 - BCY402 - 27-03-2025
BCY402 ECS Module-5 Notes - 3973 - BCY402 - 27-03-2025
Semester: 04 Credits: 04
Number of Contact Hours/Week 3:0:2:0 CIE Marks: 50
Total Number of Hours: 40 Exam Marks: 50
Module - V
Cryptography Concepts and Techniques:
• Introduction
• Plain text and Cipher Text
• Substitution Techniques
• Transposition Techniques
• Encryption and Decryption
• Symmetric and Asymmetric Key Cryptography
• Steganography
• Key Range and Key Size
• Possible types of Attacks
Introduction
This is the age of universal electronic connectivity, where the activities like hacking,
viruses, electronic fraud are very common. Unless security measures are taken, a network
conversation or a distributed application can be compromised easily.
Network Security has been affected by two major developments over the last several decades. First
one is introduction of computers into organizations and the second one being introduction of
distributed systems and the use of networks and communication facilities for carrying data between
users & computers. These two developments lead to ‘computer security’ and ‘network security’,
where the computer security deals with collection of tools designed to protect data and to thwart
hackers. Network security measures are needed to protect data during transmission. But keep in
mind that, it is the information and our ability to access that information that we are really trying to
protect and not the computers and networks.
Why We Need Information Security?
Because there are threats: Threats A threat is an object, person, or other entity that represents a
constant danger to an asset The 2007 CSI survey
Definitions
➢ Cybersecurity -is the protection of information that is stored, transmitted, and processed in
a networked system of computers, other digital devices, and network devices and
transmission lines, including the Internet.
➢ Computer Security - generic name for the collection of tools designed to protect data and
to thwart hackers
➢ Network Security - measures to protect data during their transmission.
➢ Internet Security - measures to protect data during their transmission over a collection of
interconnected networks our focus is on Internet Security which consists of measures to
deter, prevent, detect, and correct security violations that involve the transmission & storage
of information.
Dept. of CSE (CY), RNSIT Page 2
Module-V BCY402: ECS
Security Objectives:
The cybersecurity definition introduces three key objectives that are at the heart of information and
network security:
• Security attack: Any action that compromises the security of information owned by an
organization.
• Security mechanism: A process (or a device incorporating such a process) that is designed
to detect, prevent, or recover from a security attack.
• Security service: A processing or communication service that enhances the security of the
data processing systems and the information transfers of an organization.
Security Attack
Any action that compromises the security of information owned by an organization information
security is about how to prevent attacks, or failing that, to detect attacks on information-based
systems often threat & attack used to mean same thing have a wide range of attacks can focus of
generic types of attacks
➢ Passive
➢ Active
Active attacks: Modification of the data stream or the creation of a false stream
➢ Masquerade: Takes place when one entity pretends (pose as) to be a different entity.
➢ Replay: The passive capture of a data unit and its subsequent retransmission to produce an
unauthorized effect.
➢ Denial of service: Prevents the normal use of communication facilities.
➢ Data modification: Involve a man-in-the middle attack, in which the attacker selectively
modifies communicated data between a client and server
The other aspect of confidentiality is the protection of traffic flow from analysis. Ex: A credit card
number has to be secured during online transaction.
Authentication: This service assures that a communication is authentic. For a single message
transmission, its function is to assure the recipient that the message is from intended source. For an
ongoing interaction two aspects are involved. First, during connection initiation the service assures
the authenticity of both parties. Second, the connection between the two hosts is not interfered
allowing a third party to masquerade as one of the two parties. Two specific authentication services
defines in X.800 are
Peer entity authentication: Verifies the identities of the peer entities involved in communication.
Provides use at time of Media connection establishment and during data transmission. Provides
confidence against a masquerade or replay attack
Data origin authentication: Assumes the authenticity of source of data unit, but does not provide
protection against duplication or modification of data units. Supports applications like electronic
mail, where no prior interactions take place between communicating entities.
Integrity: Integrity means that data cannot be modified without authorization. Like
confidentiality, it can be applied to a stream of messages, a single message or selected fields within
a message. Two types of integrity services are available. They are:
Connection-Oriented Integrity Service: This service deals with a stream of messages, assures
that messages are received as sent, with no duplication, insertion, modification, reordering or
replays. Destruction of data is also covered here. Hence, it attends to both message stream
modification and denial of service.
Access Control: This refers to the ability to control the level of access that individuals or entities
have to a network or system and how much information they can receive. It is the ability to limit
and control the access to host systems and applications via communication links.
Security Mechanisms
According to X.800, the security mechanisms are divided into those implemented in a specific
protocol layer and those that are not specific to any particular protocol layer or security service.
Incorporated into the appropriate protocol layer in order to provide some of the OSI security
services, Encipherment: It refers to the process of applying mathematical algorithms for
converting data into a form that is not intelligible. This depends on algorithm used and encryption
keys.
Digital Signature: The appended data or a cryptographic transformation applied to any data unit
allowing to prove the source and integrity of the data unit and protect against forgery.
Access Control: A variety of techniques used for enforcing access permissions to the system
resources.
Data Integrity: A variety of mechanisms used to assure the integrity of a data unit or stream of
data units.
Authentication Exchange: A mechanism intended to ensure the identity of an entity by means of
information exchange.
Traffic Padding: The insertion of bits into gaps in a data stream to frustrate traffic analysis
attempts. Routing Control: Enables selection of particular physically secure routes for certain data
and allows routing changes once a breach of security is suspected.
Notarization: The use of a trusted third party to assure cert in properties of a data exchange
Cryptography
Cryptography, or cryptology, is the practice and study of techniques for secure communication in
the presence of adversarial behavior.
▪ Plaintext: This is the original intelligible message or data that is fed into the algorithm as
input.
▪ Encryption algorithm: The encryption algorithm performs various substitutions and
transformations on the plaintext.
▪ Secret key: The secret key is also input to the encryption algorithm. The key is a value
independent of the plaintext and of the algorithm. The algorithm will produce a different
output depending on the specific key being used at the time.
▪ Ciphertext: This is the scrambled message produced as output. It depends on the plaintext
and the secret key. For a given message, two different keys will produce two different
ciphertext. The ciphertext is an apparently random stream of data and, as it stands, is
unintelligible.
▪ Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes
the ciphertext and the secret key and produces the original plaintext.
1. Caesar Cipher
2. Monoalphabetic cipher
3. Playfair Cipher
4. Hill Cipher
5. Polyalphabetic Cipher
6. One Time Pad
1. Caesar Cipher
The earliest known, and the simplest, use of a substitution cipher was by Julius Caesar.
2. Monoalphabetic cipher
With only 25 possible keys, the Caesar cipher is far from secure.
Comparing this breakdown with below figure, it seems likely that cipher letters P and Z are the
equivalents of plain letters e and t, but it is not certain which is which. The letters S, U, O, M, and
H are all of relatively high frequency and probably correspond to plain letters from the set {a, h, i,
n, o, r, s}. The letters with the lowest frequencies (namely, A, B, G, Y, I, J) are likely included in
the set {b, j, k, q, v, x, z}.
Example
3. Playfair Cipher
➢ In this scheme, pairs of letters are encrypted, instead of single letters as in the case of
simple substitution cipher.
➢ It is also known as square or Wheatstone-Playfair cipher and Invented in 1854 by Charles
Wheatstone ,promoted by Lord Playfair
➢ In Playfair cipher, initially a key table is created. The key table is a 5×5 grid of alphabets
that acts as the key for encrypting the plaintext. Each of the 25 alphabets must be unique
and one letter of the alphabet (usually J) is omitted from the table as we need only 25
alphabets instead of 26. If the plaintext contains J, then it is replaced by I.
➢ 5 X 5 matrix constructed using a keyword/Key (Ex: Monarchy)
Example:
4. Polyaphabetic Cipher
Example:
Vernam Cipher
6. Hill Cipher
❖ Transposition Techniques:
➢ All the techniques examined so far involve the substitution of a cipher text 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.
➢ Types: Rail Fence Technique
Row Column Transposition
❖ Steganography
A plaintext message may be hidden in any one of the two ways. The methods of Steganography
conceal the existence of the message, whereas the methods of cryptography render the message
unintelligible to outsiders by various transformations of the text.
A simple form of Steganography, but one that is time consuming to construct is one in which an
arrangement of words or letters within an apparently innocuous text spells out the real message.
e.g., (i) the sequence of first letters of each word of the overall message spells out the real (hidden)
message. (ii) Subset of the words of the overall message is used to convey the hidden message.
Various other techniques have been used historically, some of them are:
➢ Character marking – selected letters of printed or typewritten text are overwritten in pencil.
The marks are ordinarily not visible unless the paper is held to an angle to bright light.
➢ Invisible ink – a number of substances can be used for writing but leave no visible trace until
heat or some chemical is applied to the paper.
➢ Pin punctures – small pin punctures on selected letters are ordinarily not visibleunless the
paper is held in front of the light.
➢ Typewritten correction ribbon – used between the lines typed with a black ribbon, the results
of typing with the correction tape are visible only under a strong light.
Drawbacks of Steganography
➢ Requires a lot of overhead to hide a relatively few bits of information.
➢ Once the system is discovered, it becomes virtually worthless.
1. Plain Text (x): This is the original data/message that is to be communicated to the receiver
by the sender. It is one of the inputs to the encryption algorithm.
2. Secret Key (k): It is a value/string/textfile used by the encryption and decryption algorithm to
encode and decode the plain text to cipher text and vice-versa respectively. It is independent of
the encryption algorithm. It governs all the conversions in plain text. All the substitutions and
transformations done depend on the secret key.
3. Encryption Algorithm (E): It takes the plain text and the secret key as inputs and produces
Cipher Text as output. It implies several techniques such as substitutions and transformations on
the plain text using the secret key.
E(x, k) = y
4. Cipher Text (y): It is the formatted form of the plain text (x) which is unreadable for
humans, hence providing encryption during the transmission. It is completely dependent upon
the secret key provided to the encryption algorithm. Each unique secret key produces a unique
cipher text.
5. Decryption Algorithm (D): It performs reversal of the encryption algorithm at the recipient’s
side. It also takes the secret key as input and decodes the cipher text received from the sender
based on the secret key. It produces plain text as output.
D(y, k) = x
In particular, Feistel proposed the use of a cipher that alternates substitutions and permutations,
where these terms are defined as follows:
▪ ■ Substitution: Each plaintext element or group of elements is uniquely replaced by a
corresponding ciphertext element or group of elements.
To make it easy to understand, we'll use very small numbers, but in real-world RSA, these numbers
are enormously large.
Example 1:
A. Key Generation:
1. Choose two prime numbers: Let's say p = 3 and q = 11.
2. Calculate n: n = p * q = 3 * 11 = 33.
3. Calculate φ(n) (phi of n): φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20.
4. Choose a number 'e' (public key exponent) that is less than φ(n) and coprime to it
(meaning they share no common factors other than 1). Let's say e = 7.
5. Calculate 'd' (private key exponent): 'd' is the modular multiplicative inverse of 'e'
modulo φ(n). In simpler terms, (d * e) % φ(n) must equal 1. In our case, d = 3
because (3 * 7) % 20 = 1.
6. Public key: (n, e) = (33, 7)
7. Private key: (n, d) = (33, 3)
B. Encryption:
1. Let's say the message we want to encrypt is 'm' = 2.
2. The encrypted message 'c' is calculated as: c = m^e mod n.
3. So, c = 2^7 mod 33 = 128 mod 33 = 29.
4. The encrypted message is 29.
C. Decryption:
1. To decrypt the message, we use the private key: m = c^d mod n.
2. So, m = 29^3 mod 33 = 24389 mod 33 = 2.
3. We get back our original message, 2.
In essence:
• Someone with the public key (33, 7) can encrypt a message.
• Only someone with the private key (33, 3) can decrypt it.
Example 2:
For this example, the keys were generated as follows.
1. Select two prime numbers, p = 17 and q = 11.
2. Calculate n = pq = 17 * 11 = 187.
3. Calculate f(n) = (p- 1)(q- 1) = 16 * 10 = 160.
4. Select e such that e is relatively prime to f(n) = 160 and less than f(n); we choose e = 7.
5. Determine d such that de K 1 (mod 160) and d 6 160. The correct value is d = 23, because 23 * 7
= 161 = (1 * 160) + 1; d can be calculated using the extended Euclid’s algorithm.
The resulting keys are public key PU = {7, 187} and private key PR = {23, 187}.
The example shows the use of these keys for a plaintext input of M = 88. For encryption, we need
to calculate C = 887 mod 187. Exploiting the properties of modular arithmetic, we can do this as
follows:
887 mod 187 = [(884 mod 187) * (882 mod 187)
* (881 mod 187)] mod 187
881 mod 187 = 88
882 mod 187 = 7744 mod 187 = 77
884 mod 187 = 59,969,536 mod 187 = 132
887 mod 187 = (88 * 77 * 132) mod 187 = 894,432 mod 187 = 11
With every incremental bit, the attacker has to perform double the number of operations as
compared to the previous key size. It is found that for a 56-bit key, it takes 1 second to search 1
percent of the key range. Taking this argument further, it takes about 1 minute to search about half
of the key range (which is what is required, on an average, to crack a key). Using this as the basis,
let us have a look at the similar values (time required for a search of 1 percent and 50 percent of the
key space) for various key sizes. This is shown in Table
We can represent the possible values in the key range using hexadecimal notation and see visually
how an increase in the key size increases the key range and therefore, the complexity for an
attacker
Possible Types of Attack
1. Brute Force Attacks
Mitigation: longer encryption keys and implementing mechanisms that lock out attackers
after multiple failed attempts.
2. Man-in-the-Middle (MITM) Attacks- Use VPN
3. Cryptanalysis Attacks: flaws in the design
4. Phishing And Social Engineering Attacks
5. Side-Channel Attacks: Target data exposed during cryptographic procedures, such as time
or power usage.
6. DNS Spoofing
7. SQL Injection
8. XSS Attack