CNS- Notes Unit-1 PDF
CNS- Notes Unit-1 PDF
Unit IV: Data Integrity, Digital Signature Schemes & Key Management
Cryptographic Attacks
Accessing of data by unauthorized entity is called as attack
Passive Attacks
Active Attacks
Passive Attacks:
In a passive attack, the attacker’s goal is just to obtain information. This means that the attack does not
modify data or harm the system.
Active Attacks:
An active attack may change the data or harm the system. Attacks that threaten the integrity and availability
are active attacks.
Passive Attacks
(a) Release of message content –
Capture and read the content transmissions.
(b) Traffic Analysis–
• can’t read the information, but observe the pattern
• determine the location and identity of communicating parties
• observe frequency and length of communication
Active Attacks
(a) Masquerading: Masquerading or snooping happens when theattacker impersonates somebody else.
(b) Replay–
The attacker obtains a copy of a message sent by a user and later tries to replay it.
(c) Modification: After intercepting or accessing information, the attacker modifies the information then
send to receiver.
(d) Denial of service: Denial of service (Dos) is a very common attack.it may slow down or totally interrupt
the service of a system.
• Data Confidentiality: It is designed to protect data from disclosure attack.. That is, it is designed to
prevent snooping and traffic analysis attack.
• Data Integrity: It is designed to protect data from modification, insertion, deletion and replaying by
an adversary
• Authentication: It provides the authentication of the party at the other end of theline.
• Non-repudiation: It protects against repudiation by either the sender or the receiver of the data.
• Access Control: It provides protection against unauthorized access to data
Security Mechanism:
• Encipherment:The use of mathematical algorithms to transform data into a form that is not readily
understandable
• Data Integrity:A variety of mechanisms used to assure the integrity of a data unit or stream of data
units.
• Digital Signature:A digital signature is a means by which the sender can electronically sign the data
and the receiver can electronically verify the signature.
• Authentication Exchange: A mechanism intended to ensure the identity of an entity by means of
information exchange.
• Routing Control:Enables selection of particular physically secure routes for certain data and allows
routing changes, especially when a breach of security is suspected.
• Traffic Padding: Inserting bogus data to prevent traffic analysis.
• Notarization:The use of a trusted third party to assure certain properties of a data exchange.
• Access Control:A variety of mechanisms that enforce access rights to resources.
Relation Security Services and Mechanisms
➢ Security Mechanism: A mechanism that is designed to detect, prevent, or recover from a security attack.
➢ Security Service: A service that enhances the security of data processing systems and information
transfers. A security service makes use of one or more security mechanisms.
MATHEMATICS OF CRYPTOGRAPHY
Integer Arithmetic: In Integer arithmetic, we are use a set and a few operations.
➢ Set of Integers: The set of Integers, denoted by z, contains all integral numbers (with no fraction)
from negative infinity to positive infinity.
➢ Binary Operations: A Binary operation takes two inputs and creates one output. Three common
binary operations defined for integers are addition, subtraction and multiplication.
➢ Examples:
Add: 5+9=14 (-5)+9=4 5+(-9)=-4
Subtract: 5-9=-4 (-5)-9=14 5-(-9)=14
Multiply: 5x9=45 (-5)x9=-45 5x(-9)=45
Integer Division: if we divide a by n, we can get q and r. The relationship between these four integers can be
shown as
a=q x n + r
a is dividend, n is the divisor, q is quotient , r is remainder
➢ Examples: Assume that a = 255 and n = 11. We can find q = 23 and r = 2 using the division
algorithm. We have shown in following
Two Restrictions:
• First, we require that the divisor be a positive integer (n > 0).
• Second, we require that the remainder be a non-negative integer ( r > 0 ).
Integer Division
➢ The Extended Euclidean Algorithm can calculate the gcd ( a, b) and at the same time calculate the
value if s and t.
Example: Given a = 161 and b = 28,
Find gcd (a,b) and the values of s and t.
Solution:
r = r1 – q x r2 , t = t1 – q x t2 , s = s1 – q x s2 , We use a table to follow the algorithm.
Modular Arithmetic
The division relationship ( a = q x n + r ) has two inputs ( a and n ) and two outputs ( q and r ). In modular
arithmetic, we are focused in only one of the outputs, the remainder r.
Modulo Operator:
• Modulo operator is shown as mod.
• The second input (n) is called the modulus.
• The output r is called the residue.
The below figure shows the division relation compared to the modulo operator
The modulo operator (mod) takes an integer (a) from the set Z and a positive modulus (n). The operator
creates a non-negative residue (r).
a mod n = r
- Example
SET OF RESIDUES: Zn
The result of the modulo operation with modulus ‘n’ is always an integer between 0 and n-1.
In other words (a mod n) is always a non negative integer less than n
Modulus operation creates a set, that is called set of least residues modulo n or Z n
We have one set of Z(integers), but we have infinite instances of the set o residues Zn for each n.
CONGRUENCE (≡)
If two numbers A and B have the property that their difference A-B is integrally divisible by a number C
(i.e., (A-B)/C is an integer), then A and B are said to be "congruent modulo C." The number C is called the
modulus , and the statement "A is congruent to B (modulo C)" is written mathematically as
A ≡ B ( mod C)
This says that “ A is congruent to B modulo C”.
Example 2:
Assume, -8≡12(mod 10) 2≡12(mod 10) 12≡22(mod 10) 22≡32(mod 10)
RESUDUE CLASSES
A residue class [a] is the set of integers congruent modulo n.
In other words it is the set of all integers such that x=a (mod n).
For example, if n=5, we have five sets [0], [1], [2], [3], [4] as shown below
[0]= { ...., -15 -10 ,-5, 0, 5, 10,15,...}
[1]= { ...., -16 -11 ,-6, 1, 6, 11,16,...}
[2]= { ...., -17 -12 ,-7, 2, 7, 12,17,...}
[3]= { ...., -18 -13 ,-8, 3, 8, 13,18,...}
[4]= { ...., -19 -14 ,-9, 4, 9, 14,19,...}
From each set there is one lease residue that
0 in [0], 1 in [1], 2 in [2], 3 in[3] and 4 in [4]..
The set of these residues are shown as
Z5 ={0,1,2,3,4}
Applications:
We use a clock to measure time. Our clock system uses modulo 12 arithmetic. How ever instead of a 0 we
the 12
.
Operations in Zn
The three Binary operations (addition, subtraction and multiplication) are defined for the set Z n.
Example 2
Perform the following operation:
a. Add 17 to 27 in Z14
(17+27) mod 14 = (44) mod 14 = 2
b. Subtract 34 from 12 in Z13
(12-34) mod 13 = (-22) mod 13 = - 9 = (-9+13) = 4
c. Multiply 123 by -10 in Z20
(123*(-10)) mod 20 = (-1230) mod 20 = -10 =(-10+20) = 10
Property 1:
(a+b) mod n= [ (a mod n ) + (b mod n) ] mod n
(4+5) mod 2 = [ (4 mod 2) + ( 5 mod 2) ] mod 2
9 mod 2 = [0 + 1] mod 2
1 = 1
Property 2:
(a-b) mod n= [ (a mod n ) - (b mod n) ] mod n
(4 - 5) mod 2 = [ (4 mod 2) - ( 5 mod 2) ] mod 2
-1 mod 2 = [0 - 1] mod 2
-1 mod 2 = -1 mod 2
Property 3:
(axb) mod n= [ (a mod n ) x (b mod n) ] mod n (4 x 5) mod 2 = [ (4 mod 2) x ( 5 mod 2) ] mod 2 20
mod 2 = [0 x 1] mod 2
0 = 0 mod 2
0 = 0
INVERSES
When we are working in modular arithmetic, we need to find inverse of a number relative to an operation.
There are two types of inverses are used modular arithmetic.
• Additive inverse (relative to an additionoperation).
• Multiplicative inverse (relative to a multiplication operation).
It can be proved that ‘a’ has a multiplicative inverse in Zn iff gcd(n,a)=1. (In this case ‘a’ and n are said to
relatively prime.
Example 1: Find multiplicative inverse of 8 in Z10.
Examples:
Addition : CIJ=AIJ+ BIJ
Subtraction: : CIJ=AIJ - BIJ
Multiplication
Examples:
Multiplication unit matrix with normal matrix gives the same matrix
AXI=IXA=A
DETERMINANT
If A is square matrix of mxm then determinant of A is det(A)
Where Aij is a matrix obtained from A by deleting the ith row and jth column.
Determinant is obtained for only square matrices
Det(2x2) matrix
Residue Matrices
Example : Find A-1 modulo value -
Problem:
Solution:
Linear Congruence
Single variable Linear Equations:
Equations of the form ax ≡ b (mod n) might have no solution or a limited number of solutions
Assume that the gcd(a,n) = d.
If d + b (d not divides b), there is no solution.
If d | b (d divides b), there are d solutions.
If d | b, we use the following strategy to find the solutions:
➢ Reduce the equation by dividing both sides of the equation (including the modulus) by d.
➢ Multiply both sides of the reduced equation by the multiplicative inverse of ‘a’ to find the particular
solution x0.
➢ The General solutions are x = x0 + k ( n / d ) for k = 0, 1, 2, , (d-1).
Congruence-Example
Example 1: Solve the equation
10 x = 2( mod 15).
Solution :-
Given Linear equation 10x≡ 2(mod 15)
In basic form ax ≡ b(mod n)
a = 10 ; b = 2; n= 15
Now, find d = ?
d = gcd(a,n)= gcd (10,15)
= gcd (15,10) = gcd (10,5)
= gcd (5,0)
=5
check if d+b (d not divides b), then no solution
5+2 means ‘5’ not divides ‘2’, so, The given
equation has No solution.
Example 2: Solve the equation
14 x= 12 (mod 18)
Solution :- Given Linear equation
14x ≡ 12(mod 18)
In basic form ax ≡ b(mod n)
a = 14 ; b = 12; n= 18
d = gcd(a,n)= gcd (14,18) = gcd (18,14)
= gcd (14,4) = gcd (4,2)=gcd(2,0)=2
check, d b or d+ b
d|b→ 2 | 12 means “ 2 divides 12”, so the given equation have “2 solutions”.
Given equation 14 x 12 (mod 18)
divides ‘d’ on both sides of equation
7x 6 (mod 9)
multiply 7 -1 on both sides of above to get particular solution ‘x0’.
7 -1 x 7 * x0 ≡ 6 * 7 -1 (mod 9)
x0 ≡ 6x 7 -1 (mod 9) i.e 7-1 mod 9 ≡ 4
x0 ≡ 6 x 4 (mod 9)
x0 ≡ 24 mod 9
x0 ≡ 6
solutions are x = x0 + k (n/d) where k = 0,1
( d = 2)
if k = 0 x = x0 + 0 (n/ d)
x = 6+ 0 ( 18/2) = 6
x=6
if k = 1 x = x0 +1 ((n/ d) = 6+1 ( 18/2)
x = 15
‘6’ and ‘15’ are solution to 14 x 12 (mod 18)
Example
Solve the following sets of Linear equations?
3x + 2y ≡ 5 ( mod 7 )
4x + 6y ≡ 4 ( mod 7 )
LINEAR DIOPHANTINE EQUATION
The equation of the form ax +by = c is called as Linear Diophantine Equation.
Example: 19x +13y = 20
We can solve the above equation using following steps:
Step1: check whether it has solution or not.
Perform gcd(a,b) and if gcd(a,b) divides c then it has solution
Step 2: Use Euclidian Algorithm and reverse Euclidian algorithms to find the Particular solution.. x 0, y0
Step3: Find general solution
x=x0+b.n where n is any integer
y=y0-a.n
Example 1:-
Find particular and General solutions to the following Linear Diophantine Equation:
25x+10y=15
Solution:
a=25, b=10 and c=15
Check whether we have solution or not by calculating GCD(25,10) using Euclidian Algorithm:
gcd(25,10)=gcd(10,5)=gcd(5,0)=5
since gcd(25,10)=5 that divides the 15, we have solutions.
Reverse Euclidian Algorithm is:
25 = 2 x 10 + 5 --------- Eq1
10 = 2 x 5 + 0
Since gcd is 5 , rewrite the Eq1 from write to left:
5= 25 – 2 x10
5= 1x25 – 2x10 (1x25 – 2x10 is similar to 25x + 10y)
Multiply both sides by 3 since in the given equation right hand side is 15
3x5=3(1x25)-3(2x10)
15 = 3 x 25 – 6 x 10 then it can be rewrite as
25x3 – 10x6 = 15
The above is similar to
25x + 10y = 15
So, the particular solution is
x0 = 3 and y0 = -6
Substitute the x0 and y0 in the above 25x 0 + 10y0 = 25x3+10(-6)=75-60=15
Now, find General solution:
x=x0+b.n (where n is any integer and a=25, b=10)
y=y0-a.n
• if n=1, then
x=3+10x1=13
y=-6-25x1=-31
Substitute the x and y in the given equation to check result:
25x + 10y = 25x13+10(-31)=325-310=15
• if n= -1, then
x=3+10x(-1)=3-10= -7
y=-6-25x(-1)= -6 +25 = 19
Substitute the x and y in the given equation to check result:
25x + 10y = 25x(-7)+10(19)=-175+190=15
Finally, the x,y pairs are (-7,19), (3,-6), (13,-31),….
Example 2:
Find particular and General solutions to the following Linear Diophantine Equation:
19x+13y=20
Solution:
A=19, b=13 and c=20
Check whether we have solution or not by calculating GCD(19,13) using Euclidian Algorithm:
gcd(19,13)=gcd(13,6)=gcd(6,1)=gcd(1,0)=1
since gcd(19,13)=1 that divides the 20, we have solutions.
Reverse of Euclidian Algorithm is :
19= 1 x13+ 6 -------------- (Eq 1)
13= 2 x 6 + 1 ------------- (Eq 2)
6 = 6x1 + 0
So, gcd(19,13) is 1.
• Rewrite the Eq 2 from write to left:
1 = 13 – 2 x 6 ------------- (Eq 3)
• Rewrite the Eq 1 from write to left:
6 = 19 – 1 x13 ------------- (Eq 4)
Substitute the 6 equivalent in Eq 4 that is 19-1x13 in Eq 3
1= 13- 2 x (19-1x13)
1= 13-2x19 + 2 x13
1= 1x13-2x19 + 2 x13
1= 3x13-2x19
Multiply both sides by 20 since in the given equation right hand side is 20
20x1=60x13-40x19)
20 = 13x60 – 19 x 40 then it can be rewrite as
This can be rewrite as similar to the given equation 19x+13y=20
13x60-19x40 = 20
-19x40 + 13x 60 =20
19x(-40)+13x60=20
So, the particular solution is
x0 = -40 and y0 = 60
Substitute the x0 and y0 in the given equation to check the result
19x+13y = 19(-40) + 13x60 = -760+780 = 20
Now, find General solution:
x=x0+b.n (where n is any integer and a=19, b=13)
y=y0-a.n
• if n=1, then
x=-40+13x1=-40+13= -27
y=60 –19x1=41
Substitute the x and y in the given equation to check result:
19x + 13y = 19(-27)+13(41)=-513+533=20
• if n= -1, then
x=-40+13x(-1)=-40-13= -53
y=60-19x(-1)= 60+19 = 79
Substitute the x and y in the given equation to check result:
19x + 13y = 19x(-53)+13(79)=-1007+1027=20
Finally, the x,y pairs are (-40,60), (-27,41), (-53,79),….