Untitled
Untitled
Untitled
Computer Security:
The protection afforded to an automated information system in order to attain the applicable objectives
of preserving the integrity, availability and confidentiality of information system resources.
a) Confidentiality:
- Data confidentiality: Assures that private or confidential information is not made available or
disclosed o unauthorized individuals.
- Privacy: Assures that individuals control or influence what information related to them maybe
collected and stored and by whom and to whom it may be disclosed.
b) Integrity:
- 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.
c) Availability: Assures that system works promptly and service is not denied to authorized users.
Important Terminologies
The OSI security architecture focuses on security attacks, mechanisms, and services. These can be
defined briefly as follows:
a) Security attack – Any action that compromises the security of information owned by an
organization
b) Security mechanism – A mechanism that is designed to detect, prevent or recover from a security
attack
c) Security service – A service that enhances the security of the data processing systems and the
information transfers of an organization.
a) SECURITY ATTACK
There are two types of attacks
• Passive attacks
• Active attacks
Passive attack
Passive attacks attempt to learn or make use of information from the system but do not affect system
resources. The goal of the opponent is to obtain information that is being transmitted.
Release of message contents: The opponent would learn the contents of the transmission. A
telephone conversation, an e-mail message and a transferred file may contain sensitive or confidential
information. We would like to prevent the opponent from learning the contents of these transmissions.
Traffic analysis: 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 that was taking place. Passive attacks are very
difficult to detect, because they do not involve any alteration of the data. However, it is feasible to
prevent the success of these attacks.
Active Attacks
These attacks involve some modification of the data stream or the creation of a false stream.
Modification of messages – The attacker captures the message and retransmits the message with
modification to produce unauthorized effect.
Denial of service – The attacker may suppress all messages directed to a particular destination.
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.
It is quite difficult to prevent active attacks absolutely, because to do so would require physical
protection of all communication facilities and paths at all times. Instead, the goal is to detect them and
to recover from any disruption or delays caused by them.
b) SECURITY SERVICES
X.800 defines a security service as a service that is provided by a protocol layer of communicating
open systems and that ensures adequate security of the systems or of data transfers.
The classification of security services are as follows:
(i) Authentication: The authentication service is concerned with assuring that a communication is
authentic.
Two specific authentication services are defined in X.800:
• Peer entity authentication: Provide confidence in the identity of entities connected.
• Data origin authentication: Provide assurance that the source of received data is as claimed.
(ii) Access control: Access control is the ability to limit and control the access to host systems and
applications.
(iii) Data Confidentiality: Confidentiality is the protection of transmitted data from passive attacks.
• Connection Confidentiality
The protection of all user data on a connection.
• Connectionless Confidentiality
The protection of all user data in a single data block.
• Selective-Field Confidentiality
The confidentiality of selected fields within the user data on a connection or in a single data block.
• Traffic-Flow Confidentiality
The protection of the information that might be derived from observation of traffic flows.
(iv) Data Integrity: The assurance that data received are exactly as sent by an authorized entity.
• Connection Integrity with Recovery
Provides for the integrity of all user data on a connection and detects any modification, insertion,
deletion, or replay of any data within an entire data sequence, with recovery attempted.
• Connection Integrity without Recovery
As above, but provides only detection without recovery.
• Selective-Field Connection Integrity
Provides for the integrity of selected fields within the user data of a data block transferred over a
connection and takes the form of determination of whether the selected fields have been modified,
inserted, deleted, or replayed.
• Connectionless Integrity
Provides for the integrity of a single connectionless data block and may take the form of detection of
data modification. Additionally, a limited form of replay detection may be provided.
• Selective-Field Connectionless Integrity
Provides for the integrity of selected fields within a single connectionless data block; takes the
form of determination of whether the selected fields have been modified.
(v) Non repudiation: Provides protection against denial by one of the entities involved in a
communication of having participated in all or part of the communication.
• Nonrepudiation, Origin
Proof that the message was sent by the specified party
• Nonrepudiation, Destination
Proof that the message was received by the specified party
c) SECURITY MECHANISMS
• Encipherment:
It uses mathematical algorithm to transform data into a form that is not readily intelligible. It depends
upon encryption algorithm and key
• Digital signature:
Data appended to or a cryptographic transformation of a data unit that is to prove integrity of data unit
and prevents from forgery.
• Access control
A variety of mechanisms that enforce access rights to resources.
• Data integrity
Assures that information and programs are changed only in a specified and authorized manner
• Traffic padding
The insertion of bits into gaps in a data stream to frustrate traffic analysis attempts.
• Notarization
The use of a trusted third party to assure certain properties of a data exchange.
In symmetric key algorithms, the encryption and decryption keys are known both to sender and
receiver. The encryption key is shared and the decryption key is easily calculated from it. In many
cases, the encryption and decryption keys are the same.
In public key cryptography (or) asymmetric key cryptography, encryption key is made public, but
it is computationally infeasible to find the decryption key without the information known to the
receiver.
A message is to be transferred from one party to another across some sort of internet. The two parties,
who are the principals in this transaction, must cooperate for the exchange to take place. A logical
information channel is established by defining a route through the internet from source to destination
and by the cooperative use of communication protocols (e.g., TCP/IP) by the two principals.
A trusted third party may be needed to achieve secure transmission. For example, a third party may be
responsible for distributing the secret information to the two principals while keeping it from any
opponent.
This general model shows that there are four basic tasks in designing a particular security service:
1. Design an algorithm for performing the security-related transformation. The algorithm should be
such that an opponent cannot defeat its purpose.
2. Generate the secret information to be used with the algorithm.
3. Develop methods for the distribution and sharing of the secret information.
4. Specify a protocol to be used by the two principals that makes use of the security algorithm and
the secret information to achieve a particular security service.
Symmetric encryption also referred to as conventional encryption or single-key encryption. Here, the
sender and recipient share a common key.
A symmetric encryption scheme has five ingredients
1) Plaintext: This is the original intelligible message or data that is fed into the algorithm asinput.
2) Encryption algorithm: The encryption algorithm performs various substitutions and
transformations on the plaintext.
3) 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.
4) Cipher text: 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 cipher texts. The cipher
text is an apparently random stream of data and, as it stands, is unintelligible.
5) Decryption algorithm: This is essentially the encryption algorithm run in reverse. It takes the
cipher text and the secret key and produces the original plaintext.
It is impractical to decrypt a message on the basis of the cipher text 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.
Model of symmetric cryptosystem:
There are various types of cryptanalytic attacks based on the amount of information known to the
cryptanalyst.
Type of Attack Known to Cryptanalyst
Cipher text Only • Encryption algorithm
• Cipher text
Known Plaintext • Encryption algorithm
• Cipher text
• One or more plaintext–cipher text pairs formed with the secret key
Chosen • Encryption algorithm
Plaintext • Cipher text
• Plaintext message chosen by cryptanalyst, together with its
corresponding Cipher text generated with the secret key
Chosen Cipher • Encryption algorithm
text • Cipher text
• Cipher text chosen by cryptanalyst, together with its
corresponding decrypted plaintext generated with the secret key
Chosen Text • Encryption algorithm
• Cipher text
• Plaintext message chosen by cryptanalyst, together with its
corresponding Cipher text generated with the secret key
• Cipher text chosen by cryptanalyst, together with its
corresponding decrypted plaintext generated with the secret key
➢ Unconditionally secure
➢ Computationally secure
An encryption scheme is unconditionally secure if the cipher text generated by the scheme does not
contain enough information to determine uniquely the corresponding plaintext.
An encryption scheme is said to be computationally secure, if
If the cost of breaking the cipher exceeds the value of the encrypted information
If the time required to break the cipher exceeds the useful lifetime of the information.
Kerkhoff’s Principle:
A cryptosystem should be secure even if the attacker knows all the details about the system, with the
exception of the secret key.
SUBSTITUTION TECHNIQUES
• A substitution technique is one in which the letters of plaintext are replaced by other letters or by
numbers or symbols.
• Substitution ciphers can be categorized as either
i) Monoalphabetic ciphers ii) polyalphabetic ciphers.
• In monoalphabetic substitution, the relationship between a symbol in the plaintext to a symbol in
the ciphertext is always one-to-one.
• In polyalphabetic substitution, each occurrence of a character may have a different substitute.
The relationship between a character in the plaintext to a character in the ciphertext is one-to-many.
Caesar cipher was proposed by Julius Caesar. The Caesar cipher involves replacing each letter of the
alphabet with the letter standing 3 places further down the alphabet.
Note that the alphabet is wrapped around, so that letter following ‘z’ is ‘a’.
For each plaintext letter p, substitute the cipher text letter c such that
C = E(3, P) = (P+3) mod 26
Decryption is
P=D(3,C)=(C-3) mod 26
The general Caesar algorithm is
C = E(K, P) = (P + K) mod 26 where k takes on a value in the range 1 to 25.
The decryption algorithm is simply
P = D(K, C) = (C - K) mod 26
If it is known that a given cipher text is a Caesar cipher, then a brute-force cryptanalysis is easily
performed: simply try all the 25 possible keys.
As a first step, the relative frequency of the letters can be determined and compared to a standard
frequency distribution for English
Relative frequency of letters in English text
Only four letters have been identified, but already we have quite a bit of the message.
Continued analysis of frequencies plus trial and error should easily yield a solution from this
point. The complete plaintext, with spaces added between words, follows:
The best known multiple letter encryption cipher is the playfair, which treats digrams in the
plaintext as single units and translates these units into cipher text digrams. The playfair
algorithm is based on the use of 5x5 matrix of letters constructed using a keyword.
Let the keyword be “monarchy‟. The
matrix is constructed by
• Filling in the letters of the keyword from left to right and from top to bottom
• Duplicates are removed
• Remaining unfilled cells of the matrix is filled with remaining alphabets in alphabetical
order.
The matrix is 5x5. It can accommodate 25 alphabets. To accommodate the 26th alphabet I and J
Example
Plain text: Balloon Ba ll oo n
Ba lx lo on
Ba - I/JB
LX - SU
LO - PM
ON - NA
Strength of playfair cipher
is more difficult.
Disadvantage
Easy to break because it has the structure and the resemblance of the plain text language
(iv) HILL CIPHER
It is a multi-letter cipher. It is developed by Lester Hill. The encryption algorithm takes m
successive plaintext letters and substitutes for them m cipher text letters. The substitution is
determined by m linear equations in which each character is assigned numerical value
Each of the 26 ciphers is laid out horizontally, with the key letter for each cipher to its left. A
normal alphabet for the plaintext runs across the top. The process of encryption is simple:
Given a key letter x and a plaintext letter y, the cipher text is at the intersection of the row
labelled x and the column labelled y; in this case, the cipher text is V. To encrypt a message, a
key is needed that is as long as the message. Usually, the key is a repeating keyword.
Key=deceptive
Plain text= we are discovered save yourself
e.g., key = d e c e p t i v e d e c e p t i v e d e c e p t i v e
PT = wearediscoveredsaveyourself
CT = ZICVTWQNGRZGVTWAVZHCQYGLMGJ
Decryption is equally simple. The key letter again identifies the row. The position of the
cipher text letter in that row determines the column, and the plaintext letter is at the top of that
column.
Example:
For ‘w’: C0 = (P0 + K0) mod 26 = (22 + 3)mod 26 = 25 = ‘z’
Strength of Vigenere cipher
o There are multiple ciphertext letters for each plaintext letter.
o Letter frequency information is obscured.
Thus the cipher text is generated by performing the bitwise XOR of the plaintext and the key.
Decryption uses the same key. Because of the properties of XOR, decryption simply involves
the same bitwise operation:
Example:
P =00101001
K = 1 0 1 0 1 1 0 0 (Encryption)
C=10000101
Similarly do decryption.
Advantages
• It is unbreakable since cipher text bears no statistical relationship to the plaintext
• Not easy to break
Drawbacks
• Practically impossible to generate a random key as to the length of the message
• The second problem is that of key distribution and key protection.
Due to the above two drawbacks, one time pad is of limited use and is used for low band width
channel which needs high security.
TRANSPOSITION TECHNIQUES
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.
i) RAIL FENCE CIPHER
It is simplest of such cipher, in which the plaintext is written down as a sequence of diagonals
and then read off as a sequence of rows.
Plaintext = meet at the school house
To encipher this message with a rail fence of
depth 2, We write the message as follows:
m e a t e c o l o s
e t t h s h o h u e
The encrypted message Cipher text MEATECOLOSETTHSHOHUE
STEGANOGRAPHY
In Steganography, the plaintext is hidden. The existence of the message is concealed. For
example, the sequence of first letters of each word of the overall message spells out the
hidden message.
Various other techniques have been used historically; some examples are the following:
• Character marking: Selected letters of printed or typewritten text are overwritten in
pencil. The marks are ordinarily not visible unless the paper is held at 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 visible unless the
paper is held up in front of a light.
• Typewriter correction ribbon: Used between lines typed with a black ribbon, the results
of typing with the correction tape are visible only under a strong light.
All these techniques seem to be archaic. One of the fewer techniques is to hide the message by
using the least significant bits of frames a CD.
Alternative method is to first encrypt and then hide the message using steganography.
Drawback
• It requires a lot of overhead to hide a relatively few bits of information.
• Once the system is discovered, it becomes virtually worthless
NUMBER THEORY
Divisibility:
A non-zero b divides a if a = mb for some m where a, b and m are integers and there is no
remainder on division. It is denoted by b|a i.e. b divides a.
Eg: 3|15, -15|60
Properties of Divisibility of integers:
1. If a|1, then a = ±1
2. If a|b and b|a, then a = ±b
3. For any b, b≠0, b divides 0 i.e. b|0
4. If a|b and b|c, then a|c
5. If b|g and b|h, then b|(mg+nh) for arbitrary integers m and n
Division Algorithm:
Given any positive integer n and any non-negative integer a, if we divide a by n, then we get an
integer quotient q and an integer remainder r, such that they obey the following relationship,
a = qn + r ; 0 ≤ r ≤ n
Eg: a=11, n=7, then q=1 and r=4. Therefore a=qn+r 11=1.7 + 4
Prime and Composite Numbers:
A number b, such that b > 1 and divisible only by 1 and itself is called a prime number.
Eg: 2, 3, 5, 7, 11, 13, 17, 19…
A number n, such that n > 1, that is not prime is called composite number.
Eg: 4, 6, 8, 9, 10, 12, 14…
Greatest Common Divisor (GCD):
GCD is the greatest/largest integers dividing both a and b. it is denoted by gcd(a,b) = c where c
is the positive integer that divides a and b.
Eg: gcd(6,4) Factors of 6 – 1, 2, 3, 6, Factors of 4 – 1, 2, 4. Therefore gcd(6,4) = 2.
Relatively prime numbers:
Two integers a and b are relatively prime, if their only common positive integer factor i.e. gcd is
1.
Example: 8 and 15 are relatively prime because
Positive divisors of 8 are 1,2,4,8
Positive divisors of 15 are 1, 3, 5, 15 Therefore, common positive factor=1.
GCD by Euclidean Algorithm:
For large numbers, factorizing is difficult. Hence to speed up the operation, use Euclidean
algorithm.
Gcd(a,b) = d where a > b > 0
Eg: gcd(482,1180) a = 1180, b = 482
a=q.n+r
1180 = 2 . 482 + 216
482 = 2 . 216 + 50
216 = 4 . 50 + 16
50 = 3 . 16 + 2
16 = 2 . 8 + 0
The last non-zero remainder is 2. Therefore the gcd(482,1180) is 2.
MODULAR ARITHMETIC
Finite Set:
A set that contains countable number of elements such that an operation performed on any two
or more elements of the set will result an element from the same set.
Eg: set of alphabets (A-Z), clock
Modulus:
If a is an integer and n is a positive integer, we define a mod n to be the remainder when a is
divided by n. The integer n is called the modulus.
Congruent modulo
Two integers a and b are said to be congruent modulo n if a(mod n) = b (mod n)
a ≡ b (mod n)
Eg: 73 ≡ 4 mod 23
Properties of Congruences:
1. a≡ b (mod n) if n|(a-b)
2. a≡ b (mod n) implies b≡ a( mod n)
3. a ≡ b (mod n) and b ≡ c (mod n) imply a ≡ c (mod n).
Equivalence Classes:
a=11, n=5
a = q.n + r
11 = -1.5 + 16
11 = 0.5 + 11
11 = 1.5 + 6
11 = 2.5 + 1
11 = 3.5 + (-4)
11 = 4.5 + (-9)
There exists a set of residues or residue classes (mod n) also called equivalence classes.
The remainders are {…-9, -4, 1, 6, 11, 16, …} The remainders are different.
Similarly, for a = 10, remainders {…-10, -5, 0, 5, 10, 15, …}
a = 12, remainders {…-8, -3, 2, 7, 12, …}
a = 13, remainders {…, -7, -2, 3, 8, 13, …}
a = 14, remainders {… -6, -1, 4, 9, 14, …}
The above are the residue or equivalence classes for mod 5.
Eg: 48 mod 5 ≡ ?
(42.42.42.42) mod 5
(16.16.16.16) mod 5
(1.1.1.1) mod 5
1 mod 5 ≡ 5
EUCLIDEAN ALGORITHM
Euclidean algorithm is a simple procedure for determining the greatest common divisor
of two positive integers.
The positive integer c is said to be the greatest common divisor of a and b if c is a divisor of a
and of b.
For any integers a, b, with a ≥ b ≥ 0, gcd(a, b) = gcd(a mod b, b)
Example
gcd(55, 22)
gcd(55 mod 22, 22) = gcd(11, 22)
gcd(22, 11) = gcd(22 mod 11, 11) = gcd(0,11) = 11
gcd(18, 12)
gcd(18 mod 12, 12) = gcd(6,12)
gcd(12,6) = gcd(12 mod 6, 6) = gcd(0,6) = 6
gcd(11,10)
gcd(11 mod 10, 10) = gcd(1, 10)
gcd(10, 1) = gcd(10 mod 1, 1) = gcd(0,1) = 1
It is used for computation in the area of finite fields and encryption algorithm such as RSA. It is
used for finding the inverse of a number mod n.
For given integers a and b, the Extended Euclidean algorithm not only calculates the gcd d, but
also two additional integers x and y that satisfy the following equation:
ax + by = d = gcd(a,b)
Multiplicative Inverse:
If gcd(a,b) = 1 = ax + by then x is the inverse of a mod b.
Steps to perform Extended Euclidean Algorithm:
1. The usual Euclidean algorithm
2. Using back substitution
Eg: gcd(43,17)
Step 1: find gcd
43 = 2 . 17 + 9 ------------------- 1
17 = 1 . 9 + 8 ------------------- 2
9=1.8+1 ------------------- 3
8=8.1+0
Gcd(43,17) = 1
Step 2: back substitution
Since gcd(43,17) = 1 = 43.x + 17.y
Re-write eq 3, 1 = 9 – 8 --------------------------- 4
From eq 2, 8 = 17 – 9 ----------------------------- 5
Sub eq 5 in eq 4, 1 = 9 – (17 – 9)
1 = 2 . 9 – 17 ----------------- 6
From eq 1, 9 = 43 – 2 . 17 ----------------------- 7
Sub eq 7 in eq 6, 1 = 2(43 – 2 . 17) – 17
1 = 2 . 43 – 4 . 17 – 17
1 = 2 . 43 – 5 . 17
x = 2, y = -5
POLYNOMIAL ARITHMETIC
Addition is defined as
Multiplication is defined as
where
FERMAT’S THEOREMS
Fermat’s theorem states the following: if p is a prime and a is a positive integer not divisible
by p, then
ap-1 ≡ 1(mod p)
Proof:
Consider the set of positive integers less than p: P = {1,2,3..p-1}
Multiply each element in P by a modulo p to get the set X ={a mod p,2a mod p,….a(p-1)mod p}.
None of the elements of X is equal to zero because p does not divide a.
No two of the integers in X are equal.
Taking two random elements from X, assume ja ≡ka mod p where 1 ≤ j < k ≤p-1 --------- 1
From eq 1, eliminate a: j ≡ k mod p ----------------2
Eq 2 is not possible because j and k are both positive integers less than p and no two integers
are equal.
Therefore, Multiplying the numbers in both sets P, X and taking the result mod p yields.
a * 2a *…*(p-1)a ≡ [(1*2*…*(p-1)](mod p)
{1 * 2 *…*(p-1)} ap-1 ≡ [(1*2*…*(p-1)](mod p)
(p-1)! ap-1≡ (p-1)!(mod p)
ap-1 ≡ 1(mod p)
1316 mod 17 = ?
P=17 (prime); p-1 = 16; a = 13
ap-1 mod p = 1
1316 mod 17 = 1
EULER’S THEOREM
Euler’s theorem states that for every a and n that are relatively prime:
a ø(n)=1(mod n)
Proof:
Case 1: n is prime
ø(n)=(n-1) and Fermat’s theorem holds.
an-1 ≡ 1 mod n , sub n-1 = ø(n)
then, a ø(n)=1(mod n) Hence proved.
For many cryptographic algorithms, it is necessary to select one or more very large prime
numbers at random. Thus, we are faced with the task of determining whether a given large
number is prime. There is no simple yet efficient means of accomplishing this task.
Miller-Rabin Algorithm
The algorithm due to Miller and Rabin is typically used to test a large number for primality.
TEST (n)
1. Find integers k, q, with k > 0, q odd, so that (n - 1 = 2kq);
2. Select a random integer a, 1 < a < n - 1;
3. if aqmod n = 1 then return("inconclusive");
4. for j = 0 to k - 1 do
5. if a(2˄j)qmod n = n - 1 then return("inconclusive");
6. return("composite");
Example: n = 43
Let us apply the test to the prime number n = 43;
1. (n - 1) = 42 =21(21) = 2kq. k=1, q = 21.
2. let a = 10.
3. Compute aqmod n, 1021 mod 43 = 42 (≠1), condition fails.
4. for j = 0 to k-1 since k=1; k-1 = 0.
5. if a(2˄j)qmod n = n – 1is true the test returns inconclusive.
10(2˄0)21mod 43 = 42 (= n-1).
So n is prime number.
Problem 1
x ≡ 1 mod 5
x ≡ 2 mod 6
x ≡ 3 mod 7
Solution:
a1=1 a2 = 2 a3 = 3
n1 = 5 n2 = 6 n3 = 7
M = n1n2n3 M = 5 * 6 * 7 = 210
mi = M/ni
m1= 210/5 = 42 m2 = 210/6 = 35 m3 = 210/7 = 30
yi = mi−1 mod ni
−1
y1 = 42 mod 5 = 3
y2 = 35−1 mod 6 = 5
y3 = 30−1 mod 7 = 4
Problem 2
A bag has contained number of pens if you take out 3 pens at a time 2 pens are left. If you
take out 4 pens at a time 1 pen is left and if you take out 5 pens at a time 3 pens are left in the
bag. What is the number of pens in the bag.
x ≡ 2 mod 3
x ≡ 1 mod 4
x ≡ 3 mod 5
M=n1n2n3
M=3*4*5=60
mi=M/ni
m1=60/3=20
m2=60/4=15
m3=60/5=12
y1 = 2 y2 = 3 y3 = 3
x=(a1m1y1+a2m2y2+ a3m3y3)mod M
=((2*20*2)+(1*15*3)+(3*12*3)) mod 60
=233 mod 60
=53