Computer Security Unit 1[1]
Computer Security Unit 1[1]
22AIE314
Unit I Syllabus
2/11/2025 2
Information security, cyber security, and network security are all
related fields that protect data and systems from security
threats, but they differ in scope and focus:
•Information security: Protects data in all forms, including digital
and physical, across its entire lifecycle. This includes protecting
the confidentiality, integrity, and availability of information.
•Cyber security: Protects internet-connected systems and data
from cyber threats, such as malware, phishing, and
ransomware. It also includes protecting user behavior and
endpoint security.
•Network security: Protects data within a network infrastructure
from threats like unauthorized access, data breaches, and denial-
of-service attacks. It also protects the network's infrastructure,
such as firewalls, routers, and switches.
2/11/2025 3
A Definition of Computer Security
2/11/2025 4
Security goals?
2/11/2025 5
CIA triad
Three key objectives that are at the heart of computer security:
• Confidentiality: This term covers two related concepts:
Data confidentiality: Assures that private or confidential information
is not made available or disclosed to unauthorized individuals.
Privacy: Assures that individual's control or influence what
information related to them may be collected and stored and by
whom and to whom that information may be disclosed.
• Integrity: This term covers two related concepts:
Data integrity: Assures that information and programs are changed
only in a specified and authorized manner.
System integrity: Assures that a system performs its intended
function in an unimpaired manner, free from deliberate or
inadvertent unauthorized manipulation of the system.
• Availability: Assures that systems work promptly and service is not
denied to authorized users.
2/11/2025 6
• Confidentiality: Preserving authorized restrictions on
information access and disclosure, including means for
protecting personal privacy and proprietary information.
A loss of confidentiality is the unauthorized disclosure of
information.
• Integrity: Guarding against improper information
modification or destruction, including ensuring information
nonrepudiation and authenticity.
A loss of integrity is the unauthorized modification or
destruction of information.
• Availability: Ensuring timely and reliable access to and
use of information.
A loss of availability is the disruption of access to or use of
information or an information system.
2/11/2025 7
• Although the use of the CIA triad to define security
objectives is well established, some in the security field
feel that additional concepts are needed to present a
complete picture.
2/11/2025 8
• Authenticity: The property of being genuine and being able
to be verified and trusted; confidence in the validity of a
transmission, a message, or message.
• Accountability: The security goal that generates the
requirement for actions of an entity to be traced uniquely to
that entity.
• This supports nonrepudiation, deterrence, fault isolation,
intrusion detection and prevention, and after-action recovery
and legal action.
• Because truly secure systems are not yet an achievable goal,
we must be able to trace a security breach to a responsible
party.
• Systems must keep records of their activities to permit later
forensic analysis to trace security breaches or to aid in
transaction disputes.
2/11/2025 9
Computer Security Terminology
• Adversary (threat agent): Individual, group,
organization, or government that conducts or
has the intent to conduct detrimental activities.
• Attack: Any kind of malicious activity that
attempts to collect, disrupt, deny, degrade, or
destroy information system resources or the
information itself.
• Countermeasure: A device or techniques that has as its objective
the impairment of the operational effectiveness of undesirable or
adversarial activity, or the prevention of espionage, sabotage, theft,
or unauthorized access to or use of Sensitive information or
information systems.
2/11/2025 10
Computer Security Terminology
• Risk: A measure of the extent to which an entity
is threatened by a potential circumstance or
event, and typically a function of
1) the adverse impacts that would arise if the circumstance or
event occurs; and 2) the likelihood of occurrence.
• Security Policy: A set of criteria for the provision
of security services.
• It defines and constrains the activities of a data
processing facility in order to maintain a
condition of security for systems and data.
2/11/2025 11
• Threat: Any circumstance or event with the potential to adversely impact
organizational operations (including mission, functions, image, or
reputation), organizational assets, individuals, other organizations, or the
Nation through an information system via unauthorized access,
destruction, disclosure, modification of information, and/or denial of
service.
2/11/2025 13
Vulnerabilities of system resources
• In the context of security, our concern is with the FOLLOWING
THREE vulnerabilities of system resources.
• The system can be corrupted, so it does the wrong thing or gives
wrong answers.
• For example, stored data values may differ from what they should
be because they have been improperly modified.
• The system can become leaky. For example, someone who should
not have access to some or all of the information available through
the network obtains such access.
• The system can become unavailable or very slow. That is, using
the system or network becomes impossible or impractical.
2/11/2025 14
• Corresponding to the various types of vulnerabilities to a system
resource are threats that are capable of exploiting those
vulnerabilities.
• A threat represents a potential security harm to an asset.
2/11/2025 16
• We can also classify attacks based on the origin of the attack:
• Inside attack: Initiated by an entity inside the security perimeter
(an “insider”).
• The insider is authorized to access system resources but uses them
in a way not approved by those who granted the authorization.
• Outside attack: Initiated from outside the perimeter, by an
unauthorized or illegitimate user of the system (an “outsider”).
• On the Internet, potential outside attackers range from amateur
pranksters to organized criminals, international terrorists, and
hostile governments.
2/11/2025 17
• A countermeasure is any means taken to deal with a security
attack.
• Ideally, a countermeasure can be devised to prevent a particular
type of attack from succeeding.
• When prevention is not possible, or fails in some instance, the goal
is to detect the attack then recover from the effects of the attack.
2/11/2025 18
THREATS, ATTACKS, AND ASSETS
• There are four kinds of threat consequences and lists the kinds
of attacks that result in each consequence.
2/11/2025 19
Threats and Assets
• The assets of a computer system can be categorized as
hardware, software, data, and communication lines and
networks.
2/11/2025 20
Network security attacks
• Network security attacks can be classified as passive attacks and
active attacks.
• A passive attack attempts to learn or make use of information
from the system, but does not affect system resources.
• An active attack attempts to alter system resources or affect their
operation.
2/11/2025 21
• Passive attacks are in the nature of eavesdropping on, or monitoring of,
transmissions.
• The goal of the attacker is to obtain information that is being transmitted.
• Two types of passive attacks are the release of message contents and
traffic analysis.
• Release of message contents: A telephone conversation, an electronic mail
message, and a transferred file may contain sensitive or confidential
information.
• We would like to prevent an opponent from learning the contents of these
transmissions.
• A second type of passive attack, traffic analysis.
• Suppose we had a way of masking the contents of messages or other
information traffic so opponents, even if they captured the message, could
not extract the information from the message.
• The common technique for masking contents is encryption.
• If we had encryption protection in place, an opponent might still be able to
observe the pattern of these messages.
• The opponent could determine the location and identity of communicating
hosts and could observe the frequency and length of messages being
exchanged.
• This information might be useful in guessing the nature of the
communication
2/11/2025 that was taking place. 22
• Passive attacks are very difficult to detect because they do not
involve any alteration of the data.
• Typically, the message traffic is sent and received in an apparently
normal fashion.
• Neither the sender nor receiver is aware that a third party has read
the messages or observed the traffic pattern.
• However, it is feasible to prevent the success of these attacks,
usually by means of encryption.
• Thus, the emphasis in dealing with passive attacks is on prevention
rather than detection.
2/11/2025 24
• Modification of messages simply means that some portion of a
legitimate message is altered, or that messages are delayed or
reordered, to produce an unauthorized effect.
• For example, a message stating, “Allow John Smith to read
confidential file accounts” is modified to say, “Allow Fred Brown
to read confidential file accounts.”
• The denial of service prevents or inhibits the normal use or
management of communication facilities.
• This attack may have a specific target; for example, an entity may
suppress all messages directed to a particular destination (e.g.,
the security audit service).
• Another form of service denial is the disruption of an entire
network, either by disabling the network or by overloading it
with messages so as to degrade performance.
2/11/2025 25
• Repudiation:
• This attack is done by either the sender or receiver. The sender or
receiver can deny later that he/she has sent or receive a message.
• For example, the customer asks his Bank “To transfer an amount
to someone” and later on the sender(customer) deny that he had
made such a request. This is repudiation.
2/11/2025 26
Shortcomings?
2/11/2025 27
Phishing attacks?
2/11/2025 28
Defend the Phishing attacks?
2/11/2025 29
Malware attacks?
2/11/2025 30
Defend against the Malware attacks?
2/11/2025 31
Distributed Denial-of Service (DDoS) attacks?
• A distributed denial-of-service (DDoS) attack is a malicious attempt to disrupt the
normal traffic of a targeted server, service or network by overwhelming the target or its
surrounding infrastructure with a flood of Internet traffic.
• From a high level, a DDoS attack is like an unexpected traffic jam clogging up the
highway, preventing regular traffic from arriving at its destination.
2/11/2025 32
Types of DDoS attacks?
• The attacks target the layer where web pages are generated on the server and delivered
in response to HTTP requests. A single HTTP request is computationally cheap to execute
on the client side, but it can be expensive for the target server to respond to, as the server
often loads multiple files and runs database queries in order to create a web page.
• Layer 7 attacks are difficult to defend against, since it can be hard to differentiate
malicious traffic from legitimate traffic.
2/11/2025 33
Types of DDoS attacks?
Application layer examples
2/11/2025 34
Types of DDoS attacks?
HTTP flood
• This attack is similar to pressing refresh in a web browser over and over on many
different computers at once – large numbers of HTTP requests flood the server, resulting
in denial-of-service.
2/11/2025 35
Types of DDoS attacks?
2. Protocol attacks
• Protocol attacks utilize weaknesses in layer 3 and layer 4 of the protocol stack to render
the target inaccessible.
2/11/2025 36
Types of DDoS attacks?
2/11/2025 37
Types of DDoS attacks?
SYN flood
• A SYN Flood is analogous to a worker in a supply room receiving requests from the
front of the store.
• The worker receives a request, goes and gets the package, and waits for
confirmation before bringing the package out front. The worker then gets many more
package requests without confirmation until they can’t carry any more packages,
become overwhelmed, and requests start going unanswered.
• This attack exploits the TCP handshake — the sequence of communications by
which two computers initiate a network connection — by sending a target a large
number of TCP “Initial Connection Request” SYN packets with spoofed source IP
addresses.
• The target machine responds to each connection request and then waits for the final
step in the handshake, which never occurs, exhausting the target’s resources in the
process.
2/11/2025 38
Types of DDoS attacks?
3. Volumetric attacks
2/11/2025 39
Types of DDoS attacks?
Amplification example:
2/11/2025 40
Types of DDoS attacks?
DNS Amplification
• A DNS amplification is like if someone were to call a restaurant and say “I’ll have one
of everything, please call me back and repeat my whole order,” where the callback
number actually belongs to the victim. With very little effort, a long response is
generated and sent to the victim.
• By making a request to an open DNS server with a spoofed IP address (the IP address
of the victim), the target IP address then receives a response from the server.
2/11/2025 41
Defend the DDoS attacks?
2/11/2025 42
Defend the DDoS attacks?
2/11/2025 43
Ransomware attacks?
2/11/2025 44
Defend the Ransomware attacks?
2/11/2025 45
Defend the Ransomware attacks?
2/11/2025 46
Man in the middle attacks?
2/11/2025 47
Defend the Man in the middle attacks?
2/11/2025 48
SQL injection attacks?
2/11/2025 49
Defend the SQL injection attacks?
2/11/2025 50
Malicious code?
• It may result in back doors, security breaches, information and data theft, and other
potential damages to files and computing systems.
2/11/2025 51
Types of Malicious code?
2/11/2025 52
Worms?
• Worms are similar to a virus but it does not modify the program. It replicates itself more
and more to slow down the computer system.
• Worms can be controlled by remote. The main objective of worms is to eat the system’s
resources.
•The WannaCry ransomware worm in 2000 exploits the Windows Server Message Block
(SMBv1) which is a resource-sharing protocol.
2/11/2025 53
Worms?
Classifications And Names Of Worms
1. Email-Worm
An email-worm refers to a worm that is able to copy itself and spread through files
attached to email messages.
2. IM-Worm
An Instant Messenger (IM) worm is a kind of worm that can spread through IM networks.
When an IM-worm is operating, it typically finds the address book belonging to the user
and tries to transmit a copy of itself to all of the person’s contacts.
3. IRC-Worm
An IRC-worm makes use of Internet Relay Chat (IRC) networks to send itself over to
other host machines. An IRC-worm drops a script into the IRC’s client directory within the
machine it infects.
4. Net-Worm
A net-worm refers to a kind of worm that can find new hosts by using shares made over a
network. This is done using a server or hard drive that multiple computers access via a
local-area network (LAN).
5. P2P-Worm
A P2P-worm is spread through peer-to-peer (P2P) networks. It uses the P2P connections to
send copies of itself to users.
2/11/2025 54
Intruders?
• Intruders are often referred to as hackers and are the most harmful factors contributing to
security vulnerability.
• They have immense knowledge and an in-depth understanding of technology and
security. Intruders breach the privacy of users and aim to steal the confidential information
of the users.
• The stolen information is then sold to third parties, aiming to misuse it for personal or
professional gains.
2/11/2025 55
Types of Intruders?
3. Clandestine user - seizes supervisory control to evade auditing and access controls
or suppress audit collection (inside|outside)
2/11/2025 56
Types of Intruders?
1. Masquerader
2/11/2025 57
Types of Intruders?
2. Misfeasor
•The category of individuals that are authorized to use the system, but misuse the granted
access and privilege.
•These are individuals that take undue advantage of the permissions and access given to
them, such category of intruders is referred to as Misfeasor.
• Misfeasors are insiders and they have direct access to the system, which they aim to
attack unethically for stealing data/ information.
2/11/2025 58
Types of Intruders?
3. Clandestine User
• The category of individuals who have supervision/administrative control over the system
and misuse the authoritative power given to them.
• The misconduct of power is often done by superlative authorities for financial gains, such
a category of intruders is referred to as Clandestine Users.
• A Clandestine User can be any of the two, insiders or outsiders, and accordingly, they can
have direct/ indirect access to the system, which they aim to attack unethically by stealing
data/ information.
2/11/2025 59
Error detection and correction?
Error
• It is a condition when the receiver’s information does not match the sender’s.
• Digital signals suffer from noise during transmission that can introduce errors in the
binary bits traveling from sender to receiver.
2/11/2025 60
Error detection and correction?
Types of Errors
1. Single-Bit Error
A single-bit error refers to a type of
data transmission error that occurs
when one bit (i.e., a single binary
digit) of a transmitted data unit is
altered during transmission, resulting
in an incorrect or corrupted data unit.
2/11/2025 61
Error detection and correction?
2. Multiple-Bit Error
A multiple-bit error is an error type that
arises when more than one bit in a data
transmission is affected. Although
multiple-bit errors are relatively rare
when compared to single-bit errors,
they can still occur, particularly in high-
noise or high-interference digital
environments.
2/11/2025 62
Error detection and correction?
3. Burst Error
When several consecutive bits are flipped
mistakenly in digital transmission, it
creates a burst error. This error causes a
sequence of consecutive incorrect values.
2/11/2025 63
Error detection and correction?
2/11/2025 64
Error detection and correction?
Simple Parity Check
1. Simple-bit parity is a simple error detection method that involves adding an extra bit to a
data transmission. It works as:
• 1 is added to the block if it contains an odd number of 1’s, and
• 0 is added if it contains an even number of 1’s.
This scheme makes the total number of 1’s even, that is why it is called even parity checking.
2/11/2025 65
Two-Dimensional Parity Check
• These bits are calculated for each row, which is equivalent to a simple parity check bit.
• Parity check bits are also calculated for all columns, then both are sent along with the
data.
• At the receiving end, these are compared with the parity bits calculated on the received
data.
2/11/2025 66
Checksum
• Unlike the checksum scheme, which is based on addition, CRC is based on binary
division.
• In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are appended
to the end of the data unit so that the resulting data unit becomes exactly divisible by a
second, predetermined binary number.
• At the destination, the incoming data unit is divided by the same number. If at this step
there is no remainder, the data unit is assumed to be correct and is therefore accepted.
• A remainder indicates that the data unit has been damaged in transit and therefore must
be rejected.
2/11/2025 69
Error detection and correction?
Cyclic Redundancy Check (CRC)
2/11/2025 70
CRC Working
Note:
CRC must be k-1 bits
Length of Code word = n+k-1 bits
Example: Let’s data to be send is 1010000 and divisor in the form of polynomial is
x3+1. CRC method discussed below.
2/11/2025 71
Error detection and correction?
2/11/2025 72
Error detection and correction?
Once the errors are detected in the network, the deviated bits sequence needs to be replaced
with the right bit sequence so that the receiver can accept the data and process it. This
method is called Error Correction. We can correct the errors in the Network in two different
ways which are listed below:
1. Forward Error Correction: In this Error Correction Scenario, the receiving end is
responsible for correcting the network error. There is no need for retransmission of the
data from the sender’s side.
2/11/2025 73
Error detection and correction?
In this method, extra parity bits are appended to the message which are used by the receiver
to correct the single bit error and multiple bit error. Consider the below example to
understand this method in a better way.
Suppose the sender wants to transmit the message whose bit representation is ‘1011001.’ In
this message:
2/11/2025 74
Error detection and correction?
2/11/2025 75
Error detection and correction?
Therefore, we have R1, R2, R3, and R4 as redundant
bits which will be calculated according to the
following rules:
1. R1 includes all the positions whose binary
representation has 1 in their least significant bit.
Thus, R1 covers positions 1, 3, 5, 7, 9, 11.
2/11/2025 77
Error detection and correction?
This message is transmitted at the receiver’s end. Suppose, bit 6 becomes corrupted and
changes to 0. Then, the message becomes ‘10101101110.’ So, at the receiver’s end, the
number of 1’s in the respective bit positions of R1, R2, R3, and R4 is rechecked to correct the
corrupted bit. This is done in the following steps:
1. For R1: bits 1, 3, 5, 7, 9, and 11 are checked. We can see that the number of 1’s in these
bit positions is 4(even) so R1 = 0.
2. For R2: bits 2,3,6,7,10,11 are checked. You can observe that the number of 1’s in these bit
positions is 5(odd) so we get a R2 = 1.
3. For R3: bits 4, 5, 6, and 7 are checked. We see that the number of 1’s in these bit
positions is 3(odd). Hence, R3 = 1.
4. For R8: bits 8,9,10,11 are observed. Here, the number of 1’s in these bit positions is 2 and
that’s even so we get R4 = 0.
If we observe the Redundant bits, they give the binary number 0110 whose decimal
representation is 6. Thus, bit 6 contains an error. To correct the error the 6th bit is changed
from 1 to 0 to correct the error.
2/11/2025 78
Cryptography?
❖Cryptography is the technique of coding data, ensuring that only
the person who is meant to see the information–and has the key
to break the code–can read it.
❖The word is a hybrid of two Greek words: “kryptós”, which means
hidden, and “graphein”, which means to write.
❖Literally, the word cryptography translates to hidden writing, but in
reality, the practice involves the secure transmission of information.
2/11/2025 79
Terminologies
• An original message is known as the plaintext, while the coded
message is called the ciphertext.
• The process of converting from plaintext to ciphertext is
known as enciphering or encryption; restoring the plaintext
from the ciphertext is deciphering or decryption.
• The many schemes used for encryption constitute the area of
study known as cryptography.
• Such a scheme is known as a cryptographic system or a
cipher.
• Techniques used for deciphering a message without any
knowledge of the enciphering details fall into the area of
cryptanalysis.
• Cryptanalysis is what the layperson calls “breaking the code.”
• The areas of cryptography and cryptanalysis together are
called cryptology.
2/11/2025 80
Cryptography?
2/11/2025 81
Encryption and decryption?
2/11/2025 82
Classification of cryptography algorithm?
Cryptography
Algorithm
Symmetric Asymmetric
Key Key
2/11/2025 83
Symmetric key cryptography/single-key encryption
2/11/2025 84
Symmetric cipher model
• A symmetric encryption scheme has five ingredients..
• 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.
• The exact substitutions and transformations performed by the
algorithm depend on the key.
2/11/2025 85
• 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
ciphertexts.
• 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.
• There are two requirements for secure use of conventional
encryption:
• 1. We need a strong encryption algorithm.
• 2. Sender and receiver must have obtained copies of the secret key
in a secure fashion and must keep the key secure.
2/11/2025 86
• We assume that it is impractical to decrypt a message
on the basis of the ciphertext plus knowledge of the
encryption/decryption algorithm.
• In other words, we do not need to keep the algorithm
secret; we need to keep only the key secret.
2/11/2025 87
• With the message X and the encryption key K as input, the encryption
algorithm forms the ciphertext Y = [Y1, Y2, …… YN].
• We can write this as Y = E(K, X)
2/11/2025 88
• This notation indicates that Y is produced by using encryption
algorithm E as a function of the plaintext X, with the specific function
determined by the value of the key K.
• The intended receiver, in possession of the key, is able to invert the
transformation:
• X = D(K, Y)
• An opponent, observing Y but not having access to K or X, may
attempt to recover X or K or both X and K.
• It is assumed that the opponent knows the encryption (E) and
decryption (D) algorithms.
• If the opponent is interested in only this particular message, then the
focus of the effort is to recover X by generating a plaintext estimate
Xn.
• Often, however, the opponent is interested in being able to read future
messages as well, in which case an attempt is made to recover K by
generating an estimate Kn .
2/11/2025 89
• Cryptographic systems are characterized along three independent
dimensions:
1. The type of operations used for transforming plaintext to ciphertext:
All encryption algorithms are based on two general principles: substitution,
in which each element in the plaintext (bit, letter, group of bits or letters) is
mapped into another element, and transposition, in which elements in the
plaintext are rearranged.
• The fundamental requirement is that no information be lost
2. The number of keys used: If both sender and receiver use the same key,
the system is referred to as symmetric, single-key, secret-key, or
conventional encryption.
• If the sender and receiver use different keys, the system is referred to as
asymmetric, two-key, or public-key encryption.
3. The way in which the plaintext is processed: A block cipher processes
the input one block of elements at a time, producing an output block for each
input block.
• A stream cipher processes the input elements continuously, producing
output one element at a time, as it goes along.
2/11/2025 90
Cryptanalysis and Brute-Force Attack
• Cryptanalysis: Cryptanalytic attacks rely on the nature of the
algorithm plus perhaps some knowledge of the general
characteristics of the plaintext or even some sample plaintext–
ciphertext pairs.
• This type of attack exploits the characteristics of the algorithm
to attempt to deduce a specific plaintext or to deduce the key
being used.
• Brute-force attack: The attacker tries every possible key on a
piece of ciphertext until an intelligible translation into plaintext
is obtained.
• On average, half of all possible keys must be tried to achieve
success.
2/11/2025 91
Various types of cryptanalytic attacks
2/11/2025 92
SUBSTITUTION TECHNIQUES
• A substitution technique is one in which the letters of plaintext are
replaced by other letters or by numbers or symbols.
• If the plaintext is viewed as a sequence of bits, then substitution
involves replacing plaintext bit patterns with ciphertext bit patterns.
• 2/11/2025
cipher: PHHW PH DIWHU WKH WRJD SDUWB 93
• For each plaintext letter p, substitute the ciphertext letter C:
• C = E(3, p) = (p + 3) mod 26
• A shift may be of any amount, so that the general Caesar algorithm
is C = E(k, p) = (p + k) mod 26
2/11/2025 94
Monoalphabetic Ciphers
• With only 25 possible keys, the Caesar cipher is far from secure.
• A dramatic increase in the key space can be achieved by allowing
an arbitrary substitution.
• Before proceeding, we define the term permutation.
• A permutation of a finite set of elements S is an ordered sequence
of all the elements of S, with each element appearing exactly once.
For example, if S = {a, b, c}, there are six permutations of S:
abc, acb, bac, bca, cab, cba
• In general, there are n! permutations of a set of n elements..
2/11/2025 95
2/11/2025 96
• In Monoalphabetic cipher, the substitute characters symbols
supports a random permutation of 26 letters of the alphabet. 26!
Permutations of the alphabet go up to 4*10^26. This creates it
complex for the hacker to need brute force attack to gain the key.
• Mono-alphabetic cipher is a type of substitution where the
relationship among a symbol in the plaintext and a symbol in the
cipher text is continually one-to-one and it remains fixed throughout
the encryption process.
• For instance, if ‘T’ is encrypted by ‘J’ for any number of appearance
in the plain text message, then ‘T’ will continually be encrypted to
‘J’.
2/11/2025 97
Polyalphabetic Ciphers
• A polyalphabetic cipher is a substitution, using multiple
substitution alphabets.
• Examples of polyalphabetic ciphers:
1. VERNAM Cipher or One-Time Pad Cipher
2/11/2025 98
VERNAM Cipher/One time pad
• Plaintext: H E L L O
7 4 11 11 14
• Key : b a x y c (length should be same as Plaintext and random)
1 0 23 24 2
• Add: 8 4 34 35 16 (Add respective numbers)
• Subtract: 8 4 8 9 16 (Any number in “Add” is more than 26
then subtract the number with 26..otherwise the number will be
the same.
• Ciphertext is: I E I J Q
2/11/2025 100
1. Repeating plaintext letters that are in the same pair are separated with a
filler letter, such as x, so that balloon would be treated as ba lx lo on.
2. Two plaintext letters that fall in the same row of the matrix are each
replaced by the letter to the right, with the first element of the row
circularly following the last. For example, ar is encrypted as RM.
3. Two plaintext letters that fall in the same column are each replaced by the
letter beneath, with the top element of the column circularly following
the last. For example, mu is encrypted as CM.
4. Otherwise, each plaintext letter in a pair is replaced by the letter that lies
in its own row and the column occupied by the other plaintext letter.
Thus, hs becomes BP and ea becomes IM (or JM, as the encipherer
wishes).
2/11/2025 101
Hill cipher
2/11/2025 102
TRANSPOSITION TECHNIQUES
• Here, the position will be changed for the original alphabets.
• Columnar transposition technique:
• Let the plaintext is: LIFEBRINGSALWAYSCHALLENGE
Key = 43512 (the individual key digits should not be greater than 5
(can be equal to) which is the highest row number)
1 2 3 4 5
L I F E B
R I N G S
A L W A Y
S C H A L
2/11/2025
L E N G E 103
1 2 3 4 5
L I F E B
R I N G S
A L W A Y
S C H A L
L E N G E
• Ciphertext= based on the key value choose the characters in the column from the
matrix.
• Here key is 43512
• So, in 4th column-→EGAAG
• in 3rd column-→FNWHN
• in 5th column-→BSYLE
• in 1st column-→FISNN
• in 2nd column-→IILCE
• So, ciphertext is: EGAAGFNWHNBSYLEFISNNIILCE
• Now the task is to find the plaintext back at the receiver end.
2/11/2025 104
Keyless transposition techniques
• Let the plaintext is: LIFEBRINGSALWAYSCHALLENGE
❖ I E R N S L A S H L E G
❖L F B I G A W Y C A L N E
• Ciphertext = IERNSLASHLEGLFBIGAWYCALNE
• The decryption process is opposite of encryption.
2/11/2025 105
Block cipher
• Block Cipher and Stream Cipher are the types of symmetric key
ciphers.
• A block cipher encrypts data in fixed-size blocks usually 64 or 128
bits at a time.
• The encryption algorithm processes each block of data separately
using the cryptographic key to transform the plaintext into the
ciphertext.
• The strength of the cipher depends upon the key length.
• However, any size of the block is acceptable.
• The following aspects can be kept in mind while selecting the size
of a block:
• Avoid very small block sizes,
• Do not have very large block sizes, and
2/11/2025• Multiples of 8-bit. 106
Key Features of Block Ciphers
• Fixed Block Size: The Data is encrypted in a fixed-size block.
• Complex Operations: In block ciphers, substitution combined
with permutation forms the operation to achieve encryption.
• Modes of Operation: Block ciphers employ several modes such
as ECB (Electronic Codebook) and CBC (Cipher Block
Chaining) for enhanced security.
• Examples: AES (Advanced Encryption Standard), DES (Data
Encryption Standard) and Blowfish.
2/11/2025 107
2/11/2025 108
Stream ciphers?
In stream cipher, one byte is encrypted at a time while in block cipher ~128 bits are
encrypted at a time. Initially, a key(k) will be supplied as input to pseudorandom bit
generator and then it produces a random 8-bit output which is treated as key stream. The
resulted key stream will be of size 1 byte, i.e., 8 bits. Stream ciphers are fast because they
encrypt data bit by bit or byte by byte, which makes them efficient for encrypting large
amounts of data quickly.
2/11/2025 109
Stream Cipher
• A stream cipher encrypts data one bit or one byte at a time
rather than in fixed-size blocks.
• It generates a keystream that is combined with the plaintext to
produce ciphertext.
• Stream ciphers are made for scenarios where data needs to be
encrypted in the continuous stream making them suitable for real-
time applications.
2/11/2025 110
Key Features of Stream Ciphers
• Continuous Encryption: The data is encrypted in a stream that
runs continuously, a bit or byte at a time
• Keystream Generation: To create encryption keys, the Stream
ciphers use a pseudorandom keystream generator.
• Efficiency: Stream ciphers are generally more efficient for
encrypting data of variable length and in streaming applications.
• Examples: RC4, Salsa20, and ChaCha20.
2/11/2025 111
Block Cipher Stream Cipher
Block Cipher Converts the plain text into Stream Cipher Converts the plain text into cipher
cipher text by taking plain text’s block at a text by taking 1 bit plain text at a time.
time.
Block cipher uses either 64 bits or more than While stream cipher uses 8 bits.
64 bits.
The complexity of block cipher is simple. While stream cipher is more complex.
Block cipher uses confusion as well as While stream cipher uses only confusion.
diffusion.
In block cipher, reverse encrypted text is While in-stream cipher, reverse encrypted text is
hard. easy.
The algorithm modes which are used in block The algorithm modes which are used in stream
cipher are ECB (Electronic Code Book) and cipher are CFB (Cipher Feedback) and OFB
CBC (Cipher Block Chaining). (Output Feedback).
Block cipher works on transposition While stream cipher works on substitution
techniques like rail-fence techniques like Caesar cipher, polygram
technique, columnar transposition technique, substitution cipher, etc.
etc.
Block cipher is slow as compared to a stream While stream cipher is fast in comparison to block
2/11/2025
cipher. cipher.
Confusion and Diffusion
2/11/2025 113
Feistel Cipher
2/11/2025 114
Data encryption standard (DES)
2/11/2025 115
Data encryption standard (DES)
• DES is a block cipher technique.
• The size of the plaintext block is of 64 bit.
• The size of initial key also of 64 bit size.
• Step 1: is to perform the initial permutation(IP). Here the bits are needs to be
rearranged in a particular order. The o/p of IP step is of the same 64 bits.
• Then, 16 rounds are performed.
• The input to round 1 is 64 bits output from IP and 48-bit key.
• Actually, 64 bit keys are converted to 48 bit key.
• From the original 64 key bits, 8 bits are parity bits (will be removed in permuted
choice-1 step). So, the output of PC-1 is 56 bits. So which 8 bits will be
discarded..that is every 8th bit of the 64 bits are discarded. i.e. the discarded bits
are, 8th , 16th , 24th , 32th, 40th, 48th, 56th , 64th bit.
• Now the total 56 bits are divided in two equal halfs..i.e, each of 28th bits..
• Now apply left circular shift to move the bits..So how many bits to be shifted is
depends on round number..
2/11/2025 116
• It means, if the round numbers are 1,2,9,16 then only one bit shift is done
else for any other rounds it will be 2 bit shift.
• After shifting it will have each 28 bits in each block.
• Then it will be combined to make 56 bits again and given to PC2.
• PC2 will permute the 56 bits to 48 bits (compressed
permutation/rearranging)and it is the input to round 1.
• The 48 key bits produced by each round by PC2 are different for different
rounds.
• After 16 rounds are completed the final permutation is done..It is also called
inverse initial permutation (inverse of initial permutation).
• The output of the final permutation is the ciphertext.
• The core/heart of DES is round function (If DES is body).
• So, what happens in round function….
2/11/2025 117
• DES is based on the Feistel Cipher, all that is required to specify
DES is −
1. Round function
2. Key schedule
3. Any additional processing − Initial and final permutation
2/11/2025 118
Initial and Final Permutation
• The initial and final permutations are straight Permutation boxes (P-
boxes) that are inverses of each other.
• They have no cryptography significance in DES.
• The initial and final permutations are shown as follows:
2/11/2025 119
Round function in DES
• The heart of this cipher is the DES function or round function.
• The DES function applies a 48-bit key to the rightmost 32
bits to produce a 32-bit output.
• There will be eight S-boxes.
2/11/2025 120
Stream ciphers?
In stream cipher, one byte is encrypted at a time while in block cipher ~128 bits are
encrypted at a time. Initially, a key(k) will be supplied as input to pseudorandom bit
generator and then it produces a random 8-bit output which is treated as key stream. The
resulted key stream will be of size 1 byte, i.e., 8 bits. Stream ciphers are fast because they
encrypt data bit by bit or byte by byte, which makes them efficient for encrypting large
amounts of data quickly.
2/11/2025 121
RC4 ciphers?
• RC4 (Rivest Cipher 4) is a widely used symmetric stream cipher designed by Ron
Rivest in 1987. It is known for its simplicity and speed in software implementations.
• RC4 is a stream cipher that encrypts data one byte at a time by generating a pseudo-
random keystream and XORing it with the plaintext (for encryption) or ciphertext (for
decryption).
• It operates with a variable-length key, typically between 40 and 256 bits, making it
adaptable to different levels of security.
2/11/2025 122
Block ciphers?
2/11/2025 123
Advanced Encryption Standard (AES)?
➢ This is a specification for the encryption of electronic data established by the U.S.
National Institute of Standards and Technology (NIST) in 2001.
➢ If it takes 128 bits as inputs then output will also be 128 bits.
➢ In the context of security, this is much stronger than Data Encryption Standard
(DES) and Triple DES.
2/11/2025 124
AES algorithm? Plaintext (128 bits)
Key (128 bits)
➢ The plaintext can be represented by some format. Add round key W [0, 3]
➢ Lets assume the plaintext as 4 x 4 matrix. Each cell is of 8 bit.
Substitute bytes
R1
Mix columns
➢ The keys are 44 word. The 128-bits will go to the add round Add round key W [0, 7]
key function and there perform an XOR between the plain text
and first four key from 0 to 3.
➢ From round 1 to 9, the steps are same, in the 10 th round the Shift rows
4 bytes
round key
2/11/2025 126
AES algorithm?
Lets understand what is there in substitution bytes
S(0,0) S’(0,0)
1 2 3 4 5 6 7
2
➢ As the input number is 01010100. We split
3 the number into two parts such as 0101 and
0100. Now 0101=5 and 0100=4.
4 ➢ It means the output value is in the 5th row
and 4th column of the AES S-table.
5 20 ➢ Suppose the value is 20. It will incorporate
as the S’(0, 0).
6
2/11/2025 127
AES algorithm?
➢ After the substitute bytes the 4 x 4 matrix output will perform shift rows.
➢ Lets understand what is there in the Shift rows.
➢ The shift rows will follow circular motion towards left.
2/11/2025 128
AES algorithm?
The next step is mix column
2 3 1 1 3
1 2 3 1 2
X
1 1 2 3 1
3 1 1 2 1
4 x 4 pre 4 x 1 output
defined matrix from shift
2 3 1 1 rows 14
1 2 3 1 11
1 1 2 3 10
3 1 1 2 14
2/11/2025 129
AES algorithm ?
2/11/2025 130
Data encryption standards (DES) ?
➢ The Data Encryption Standard (DES) was jointly developed in 1974 by IBM
and the U.S. government (US patent 3,962,539) to set a standard that everyone
could use to securely communicate with each other.
➢ It operates on blocks of 64 bits using a secret key that is 56 bits long. The
original proposal used a secret key that was 64 bits long.
➢ It is widely believed that the removal of these 8 bits from the key was done to
make it possible for U.S. government agencies to secretly crack messages.
2/11/2025 131
Data encryption standards (DES) ?
➢ From the input key, sixteen 48 bit keys are generated, one for each round. In
each round, eight so-called S-boxes are used.
➢ These S-boxes are fixed in the specification of the standard. Using the S-boxes,
groups of six bits are mapped to groups of four bits.
➢ The contents of these S-boxes has been determined by the U.S. National
Security Agency (NSA). The S-boxes appear to be randomly filled, but this is not
the case. Recently it has been discovered that these S-boxes, determined in the
1970s, are resistant against an attack called differential cryptanalysis which was
first known in the 1990s.
2/11/2025 132
DES algorithm?
• The block of the message is divided into two
halves.
2/11/2025 133
Blowfish?
• A symmetric-key block cipher called blowfish encryption is frequently used for
password hashing, VPNs, and file encryption. Since its introduction in 1993, this
encryption method has gained popularity due to its effective encryption and decryption
operations.
• However, more recent, more secure algorithms like AES are gradually taking the
place of Blowfish.
• Blowfish is a 64-bit block cipher that uses symmetric encryption and a key that can be
up to 448 bits long.
• It was created in 1993 by Bruce Schneier to replace the outdated Data Encryption
Standard (DES) and International Data Encryption Algorithm (IDEA) encryption
methods.
2/11/2025 134
Blowfish algorithm?
2/11/2025 135
Blowfish algorithm?
Step 1 − First, we divided the 64-bit plaintext into two equal blocks, L and R, each
containing 32 bits.
Step 2 − The following actions are taken in each of the 16 encryption cycles that we
begin in the following step −
2.1. Now, the L and the first member of the P-array (P1) are XORed.
2.2. Then XOR R with F, where F is a function of L and uses the four blocks that
make up the S-box. Below is a summary of function F in entirety.
2.3. The next iteration of the loop starts once L and R are switched.
Step 4 − XOR R with P17 and L with P18 to get the final two unused P-box entries
(P17 & P18).
Step 5 - The cipher text is obtained by combining L and R in the final step.
2/11/2025 136
Asymmetric key cryptography?
2/11/2025 137
Asymmetric key cryptography?
2/11/2025 138
RSA ?
• It is named after its inventors, Ron Rivest, Adi Shamir, and Leonard Adleman,
who described the algorithm in 1977.
• RSA's security relies on the practical difficulty of factoring the product of two
large prime numbers.
2/11/2025 139
Key Components of RSA?
2/11/2025 140
Key Generation Process ?
2/11/2025 141
Encryption and Decryption ?
2/11/2025 142
Example illustration ?
2/11/2025 143
Example illustration ?
2/11/2025 144
Example illustration ?
2/11/2025 145
Example illustration ?
2/11/2025 146
Elgamal ?
2/11/2025 147
Diffie Hellman ?
• Lets understand Diffie Hellman key exchange before Elgamal
• The Diffie-Hellman key exchange (also known as exponential key exchange) is a
method for securely exchanging cryptographic keys over an insecure channel. It is a
fundamental building block of many secure communication protocols, including SSL/TLS
and SSH.
2/11/2025 148
How Elgamal works?
2/11/2025 149
How Elgamal works?
2/11/2025 150
Example of Elgamal ?
2/11/2025 151
Example of Elgamal ?
2/11/2025 152
Example of Elgamal ?
2/11/2025 153
Example of Elgamal ?
2/11/2025 154
Example of Elgamal ?
2/11/2025 155
ECC?
2/11/2025 156
ECC?
2/11/2025 157
ECC?
1. ECC is based on the properties of a set of values for which operations can be
performed on any two members of the group to produce a third member, which is
derived from points where the line intersects the axes as shown with the green line
and three blue dots in the below diagram labeled A, B and C.
2. Multiplying a point on the curve by a number produces another point on the curve
(C). Taking point C and bringing it to the mirrored point on the opposite side of the
x-axis produces point D. From here, a line is drawn back to our original point A,
creating an intersection at point E.
3. This process can be completed n number of times within a defined max value. The
n is the private key value, which indicates how many times the equation should be
run, ending on the final value that is used to encrypt and decrypt data.
4. The maximum defined value of the equation relates to the key size used.
2/11/2025 158
Digital signature?
2/11/2025 159
Digital signature?
1. Digital Signatures are an Asymmetrically encrypted hash of a digital
message(data).
2. It is a value that can provide a guarantee of authenticity, non-repudiation, and
integrity.
3. In other terms, it means you can verify the sender, date & time and message
content have not been revealed or compromised.
2/11/2025 160
Digital signature?
1. Let “A” and “B” be the fictional actors in the cryptography system for better
understanding.
2. “A” is the sender and calculates the hash of the message and attaches signature
which he wants to send using his private key.
3. The other side “B” hashes the message and then decrypts the signature with A’s
public key and compares the two hashes
4. If “B” finds the hashes matching then the message has not been altered or
compromised.
2/11/2025 161
• Unit 2
Security Services: Authentication and Key Exchange
Protocols - Access control matrix – User authentication –
Directory authentication service – Diffie-Hellman key
exchange – Kerberos.
Unit 3
System security and Security models: Disaster recovery -
Protection policies. E-mail Security: Pretty good privacy
- Database Security: Integrity constraints - multi-phase
commit protocols - Networks Security: Threats in
networks - DS authentication -Web and Electronic
Commerce: Secure socket layer - Client-side certificates
- Trusted Systems: Memory protection
2/11/2025 162