SlideShare a Scribd company logo
1 of 28
 Continuation to Part1, Part2
 Number Theory: Prime and Relatively Prime Numbers, Modular Arithmetic,
Fermat’s and Euler’s Theorems, The Chinese Remainder theorem, Discrete
logarithms
 Public key: Public key cryptography principles, public key cryptography
algorithms, digital signatures, digital Certificates, Certificate Authority
and key management Kerberos, X.509
 Directory Authentication Service
Cyber Security Part -3
(Number Theory)
 Prime numbers are interesting entities.
 Prime numbers are extremely important in many branches
of mathematics.
 Prime numbers are essential to a number of real world
algorithms including most of the algorithms used in public
key (asymmetric) cryptography.
 Prime Number :A number which is divisible by it self and 1
is called as Prime number. Number which do not have
factors other than 1 and itself.
 Ex:
 2,3, 5, 7, 11, 13, 17, 19, 21, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
71, 73, 79, 83, 89, 97
Prime Numbers & Relative Prime
Numbers
 Relative Prime Numbers: two integers are called relatively prime to
one another if they have no common factors other than 1.
 Ex:
 8 and 15 are relatively prime because they have no common factors other
than 1.
 8 factors=> 1, 2,4
 15 Factors=> 1,3,5
 If GCD(a, b)=1 then a and b are relatively primes.
 Ex: GCD(8,15)=1 so 8 and 15 are relatively primes.
GCD(greatest common divisor) Logic in C:
int n1, n2, i, gcd;
printf("Enter two integers: ");
scanf("%d %d", &n1, &n2);
for(i=1; i <= n1 && i <= n2; ++i)
{
// Checks if i is factor of both integers
if(n1%i==0 && n2%i==0)
gcd = i;
}
printf("G.C.D of %d and %d is %d", n1, n2, gcd);
 12 and 15 are not relatively primes.
 12 factors=> 1,2,3, 4,6 15 factors=> 1,3,5
1
2
3
4
6
5
GCD(12,15) = 3 !=1 so 12 and
15 are not relative primes
 Properties of Primes:
 Prime Pairs: Many primes occur in pairs on either side of an even
integer.
 Ex: 2,3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
79, 83, 89, 97
 Mersenne prime: prime that can be expressed as 2p-1 where p is a
prime number.
 Note that having the form of 2p-1 does not
guarantee that the number is prime.
211-1=2047 is not a prime number; its prime factorization
is 23 * 89
Perfect Number: A perfect number is an integer > 1 which meets the
condition that the sum of its positive divisors exclusive of the number
itself is equal to the number.
Ex: 6 = 1+2+3, 28= 1+2+4+7+14, 496 and 8128
The Goldbach Conjecture : every even number could be expressed as
the sum of two prime numbers. For example, 6 = 3 + 3, 20 = 17 + 3, etc. .
 Modular arithmetic is a special type of arithmetic that
involves only integers.
 When we divide two integers we will have an
equation that looks like the following:
 A/B=Q remainder R
 A is the dividend
B is the divisor
Q is the quotient
R is the remainder
 Sometimes, we are only interested in what
the remainder is when we divide AAAby BBB.
Modular Arithmetic
 When we will use mod(%):
 To determine remaining after sharing some quantity to
some people or things.
 Example: if you have 7 rupees and 3 people. When you
share 7 rupees to 3 people. Every one will get equal
amount of money. Each will get 2 rupees.(2*3). Reaming
money is remainder (1 rupee)
 7/3=2 reminder is 1.
 To get remainder we need to use mod(%) operator.
 Visualization of Clock: For example, a clock with the 12
replaced by a 0 would be the circle for a modulus of 12.
 To find the result of A mod B, we can follow these
steps:
 Construct this clock for size B
 Start at 0 and move around the clock A steps
 Wherever we land is our solution.
 (If the number is positive we step clockwise, if
it's negative we step counter-clockwise.)
 M mod N=> M numbers, from the range of 0 and N-1.
 8 mode 4=?
 8 numbers from 0,1,2,3 in clock wise direction.
 => 1,2,3,0,1,2,3,0
 7 mode 2=?
 7 numbers from 0,1 in clockwise direction
 => 1,0,1,0,1,0,1.
 -5 mode 3=?
 5 numbers from 0,1,2 in anti clock wise direction
 => 2,1,0,2,1
 If we have A mod B and we increase A by
a multiple of B, we will end up in the same
spot, i.e.
A mod B=(A+K⋅B) mod B for any integer K.
 Symmetric Encryption Disadvantages:
1. common key is need to use at sender and receiver for
encryption and decryption.
2. Algorithms for both encryption and decryption are fixed
and known to everyone.
3. No message can be sent unless there has been some
prior agreement on a key.
4. Even if there is an agreement, if the same key is used
over an extended period of time, an eavesdropper may
be able to infer the key and break the code.
 RSA algorithm [Rivest , Shamir and Adleman] in 1978:
RSA Algorithm
 To avoid the Symmetric Encryption algorithm Issues,
introduced Asymmetric algorithms(like RSA) which uses
public key and private key concept in Cryptography.
 New keys must be transmitted between the senders and
receivers to avoid code breaking.
 The most widely used public key system is the RSA
algorithm.
 We assume that Bob and Alice wish to exchange secure
messages and that Eve is attempting to eavesdrop.
 Assume that Alice wants to send a message to Bob. Then
• Bob chooses a private key known only to him. Bob exploits a
function f to compute his public key, public = f(private).
• Bob publishes public key.
• Alice exploits Bob’s public key to compute cipher text=
encrypt(plaintext, public) and she sends cipher text to Bob.
• Bob exploits his private key to compute plaintext=
decrypt(cipher text, private). In order for this last step to work,
encrypt and decrypt must be designed so that one is the inverse
of the other.
• If there exist efficient algorithm for performing all four of the
steps, then Bob and Alice will be able to exchange messages.
• We assume that Eve knows the algorithm encrypt and decrypt .
So she could easily eavesdrop if she could infer Bob’s private key
from his public one or if she could compute decrypt without
knowing Bob’s private key.
• RSA algorithm uses the mathematical properties of modular
arithmetic and the computational properties of prime numbers
to ensure that Bob and Alice can perform their tasks efficiently
but Eve cannot.
 RSA Algorithm(for small numbers between 0 to 20)
1
select two prime numbers p=3, q=7
2
Calculate first part of public key ( which
generated by bob to share to alisa)
n=p*q=(3)*(7)=21
3
Find other part of the public key e. e stands for
encrypt
e=2
phi=(p-1)*(q-1)=(3-1)*(7-1)=2*6=12
E must be co-prime to phi and smaller than phi.
e=5
while(e<phi)
{
if(GCD(e,phi)==1)
{
break;
}
e++;
}
4
Generate private key d
//Private key (d stands for decrypt)
// choosing d such that it satisfies
// d*e = 1 + k * totient
now e=5, d=5
int k = 2; // A constant value
double d = (1 + (k*phi))/e;
= (1 + (2*12))/5
= 25/5
5
c=(msg^e)%n
d=(c^d)%n
=(12^5)%5=3
= (3^5)%5 = 12
• Select 2 prime numbers -> p=17 and q=11
• Calculate n = p×q =17 ×11=187
• Calculate = 16 × 10= 160 Select ‘e’ such that e is relatively prime to
(n)=160 and e < 160
• Determine d such that :
de =1 mod (n)
d × 7 = 1 mod 160
↓
161
• d= (e^-1) mod n [161/7= div.(d)23 and remainder (mod) =1
• d=23
1.Then the resulting keys are public key :
PU = {7, 187 }
PR = {23, 187 }
Sample RSA Algorithm
• Let Plain text message(M)=88 for encryption
Cipher Text(C) = (M^e)%n
= (88^7)%187
= (88^4 * 88^2 * 88^1)%187
= 59969536%187 * 7744%187 * 88%187
= 132 * 77 * 88
= 894432%187
= 11
• For Decryption :
Plain text M= (C^d)%n
= (11^23)%187 => (24= 8+8+4+2+1)
= (11^8 * 11^8 * 11^4 * 11^2 * 11^1) % 187
= (214358881%187 * 214358881%187 * 14641%187 *
121%187 *11%187
= 33 * 33 * 55 * 121 * 11
= 79720245 %187
= 88
 Let ”p” be a prime number, and ” a” any integer. Then
ap -a is always divisible by ”p”.
Example : a=2, p=7
2^7-2=128-2=126/7=18 reminder “0”
so 2^7-2 is divisible by 7.
In modular arithmetic notation, this can be written as
Fermat’s Little theorem
• Euler Totient Function: (n)
• (n) = how many numbers there are between 1 and n-1 that
are relatively prime to n.
• (4) = 2 (1, 3 are relatively prime to 4)
• (5) = 4 (1, 2, 3, 4 are relatively prime to 5)
• (6) = 2 (1, 5 are relatively prime to 6)
• (7) = 6 (1, 2, 3, 4, 5, 6 are relatively prime to 7)
• As you can see from (5) and (7), (n) will be n-1
whenever n is a prime number. This implies that (n) will be
easy to calculate when n has exactly two different prime
factors: (P * Q) = (P-1)*(Q-1), if P and Q are prime.
Euler's Theorem






  


• This theorem generalizes Fermat’s theorem and is an
important key to the RSA algorithm.
• If GCD(a, p) = 1, and a < p, then a (p) 1(mod p).
• In other words, If a and p are relatively prime, with a being
the smaller integer, then when we multiply a with itself
(p) times and divide the result by p, the remainder will be 1.
• Let’s test the theorem:
If a = 5 and p = 6
Then (6) = (2-1) * (3-1) = 2
So, 5 (6) = 25 and 25 = 24+1 = 6*4+1
=> 25 = 1(mod 6) OR 25 % 6 = 1
It also follows that a (p)+1 a(mod p) so that p does not
necessarily need to be relatively prime to a.


 Euler’s theorem uses modulus arithmetic which helps to lay
the foundation for RSA encryption. To construct a personal
cipher key we need an appropriate value we will call variable R.
So, we select two very large prime numbers U and V and
multiply them.
 => (R) = (U-1)*(V-1). This makes R difficult to factor, since the
fewer factors a number has, the longer it takes to find them
 We also define the variables P and Q. P is an arbitrary number
that is relatively prime to (R). Q is the calculated inverse of P
in (mod (R)).
 We use P and R to create a public key, and Q and R to create a
private key.
 This yields P*Q = 1(mod (R) ).
 The result is that too much information is lost in the
encryption due to the modulus arithmetic to decipher a
privately encrypted RSA message without the use of the
public key. Unless the would-be decipherer had enough time
and processing power to attempt a brute-force factorization.
But, the larger the primes, the longer it takes to factor their
product.




• Chinese Remainder Theorem: Let m1, m2, . . . , mn be
pairwise relatively prime positive integers,
• i.e., gcd(mi , mj ) = 1 for i != j. The system
• x ≡ a1 (mod m1)
• x ≡ a2 (mod m2)
. . .
• x ≡ an (mod mn)
• has a unique solution solution modulo m = m1m2 · · · mn, i.e.,
there is a unique solution x with 0 ≤ x < m. Furthermore, all
solutions are congruent modulo m.
Chinese Reminder Theorem
• We can construct a solution as follows.
1. Let m = m1m2 · · · mn.
2. Let Mk = m mk for all k = 1, 2, . . . , n.
3. For all k = 1, 2, . . . , n, find integers yk such
1. Mkyk ≡ 1 (mod mk).
Since gcd(Mk, mk) = 1, we know that yk exists. Euclid’s
extended algorithm can be used to find yk.
1. The integer a1M1y1 + a2M2y2 + · · · + anMnyn is a solution
of the system.
2. The integer x = (a1M1y1 + a2M2y2 + · · · + anMnyn) mod m
is the unique solution with 0 ≤ x < m.
• For example, let’s find the smallest positive integer x
such that
• x ≡ 2 (mod 3)
• x ≡ 5 (mod 7)
• x ≡ 8 (mod 11)
1. m = 3(7)(11) = 231.
2. M1 = 231/3 = 77, M2 = 231/7 = 33, M3 = 231/11 = 21.
3. We now find y1, y2, and y3.
1. 77y1 ≡ 1 (mod 3) −→ y1 = 2
2. 33y2 ≡ 1 (mod 7) −→ y2 = 3
3. 21y3 ≡ 1 (mod 11) −→ y3 = 10
4. The smallest positive integer solution is then
x = (a1M1y1 + a2M2y2 + a3M3y3) mod m
= (2(77)(2) + 5(33)(3) + 8(21)(10)) mod 231
= 2483 mod 231 = 173.
• The goal of exponentials is to calculate the product x:23
• The goal of logarithm is to calculate the exponent:
x=log2(8) (8=2x)
• In the discrete algorithm, you need to apply modulo
operation in later
• X=log28 (mod 13)
• Other way of notation: x= dlog2,13(8)
• Where: x= exponent, 2=base, 13=modulus, 8= reminder
• Simple way of the above notation
• 8=2x(mod 13)
Discrete logarithm
• Example:
• 2x (mod 7) = 4
• Let us consider x={1..6}
• X=2 or 5 satisfy above statement
• 4 (mod 7) = 4 and 32 (mod 7) = 4
• There are two solutions. In the world of cryptography we are
only interested in discrete logarithms which each exponent
have distinct reminder.
• It seems that if the modulus (p) is prim number there are
certain base values (b) which generate distinct remainders for
different exponents(x=1,…,p-1)
 Lets calculate bx (mod 7) = remainder x={1,…,6} modulus p=7
• The discrete logarithm for modulus 7 generates distinct
reminders when using base value 3 or 5 and the reminders
are in the range {1,…,6}
b b1mod7 b2mod
7
b3mod
7
b4mod
7
b5mod
7
b6mod
7
1 1 1 1 1 1 1
2 2 4 1 2 4 1
3 3 2 6 4 5 1
4 4 2 1 4 2 1
5 5 4 6 2 3 1
6 6 1 6 1 1 1
• The base value 3 and 5 are called the primitive roots of 7
or generators, often indicated by symbol . It is called
generator because applying the multiplication
operation on one single element , generates all
elements in the discrete group {1, … , p-}
• Calculating 311 mod 17=x is very easy, but doing the
opposite, calculating the discrete logarithm 11=3x mod
17 is very difficult. Especially if the modulus is at least
309 digits long.
• To solve 11=3x mod 17 a computer needs to try each
exponent x=0,1,2, .. until the equation matches.
• This is called a cyclic group of generator . After a
certain number of exponentiations and modulus
operations. We have loop.
• If the remainder has value 1, the cycle starts all over
again in the same order.
Cyber Security Part-3.pptx

More Related Content

Similar to Cyber Security Part-3.pptx

Similar to Cyber Security Part-3.pptx (20)

Unit 3
Unit 3Unit 3
Unit 3
 
11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf11 Applied_Mathemathics HANDBOOK.pdf
11 Applied_Mathemathics HANDBOOK.pdf
 
RSA
RSARSA
RSA
 
Eulers totient
Eulers totientEulers totient
Eulers totient
 
Ch08
Ch08Ch08
Ch08
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
 
Number system
Number systemNumber system
Number system
 
Assignment 2 (1) (1).docx
Assignment 2 (1) (1).docxAssignment 2 (1) (1).docx
Assignment 2 (1) (1).docx
 
Primality
PrimalityPrimality
Primality
 
Basics of Mathematical Cryptography
Basics of Mathematical CryptographyBasics of Mathematical Cryptography
Basics of Mathematical Cryptography
 
Factorization Hack of RSA Secret Numbers
Factorization Hack of RSA Secret NumbersFactorization Hack of RSA Secret Numbers
Factorization Hack of RSA Secret Numbers
 
The Complexity Of Primality Testing
The Complexity Of Primality TestingThe Complexity Of Primality Testing
The Complexity Of Primality Testing
 
Information and network security 33 rsa algorithm
Information and network security 33 rsa algorithmInformation and network security 33 rsa algorithm
Information and network security 33 rsa algorithm
 
Senior Research Final Draft3
Senior Research Final Draft3Senior Research Final Draft3
Senior Research Final Draft3
 
Real number system full
Real  number  system fullReal  number  system full
Real number system full
 
Real number system full
Real  number  system fullReal  number  system full
Real number system full
 
Ch08
Ch08Ch08
Ch08
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
 
How prime numbers keep the internet secure
How prime numbers keep the internet secureHow prime numbers keep the internet secure
How prime numbers keep the internet secure
 
Lesson 1 1 properties of real numbers
Lesson 1 1 properties of real numbersLesson 1 1 properties of real numbers
Lesson 1 1 properties of real numbers
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

Cyber Security Part-3.pptx

  • 1.  Continuation to Part1, Part2  Number Theory: Prime and Relatively Prime Numbers, Modular Arithmetic, Fermat’s and Euler’s Theorems, The Chinese Remainder theorem, Discrete logarithms  Public key: Public key cryptography principles, public key cryptography algorithms, digital signatures, digital Certificates, Certificate Authority and key management Kerberos, X.509  Directory Authentication Service Cyber Security Part -3 (Number Theory)
  • 2.  Prime numbers are interesting entities.  Prime numbers are extremely important in many branches of mathematics.  Prime numbers are essential to a number of real world algorithms including most of the algorithms used in public key (asymmetric) cryptography.  Prime Number :A number which is divisible by it self and 1 is called as Prime number. Number which do not have factors other than 1 and itself.  Ex:  2,3, 5, 7, 11, 13, 17, 19, 21, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 Prime Numbers & Relative Prime Numbers
  • 3.  Relative Prime Numbers: two integers are called relatively prime to one another if they have no common factors other than 1.  Ex:  8 and 15 are relatively prime because they have no common factors other than 1.  8 factors=> 1, 2,4  15 Factors=> 1,3,5  If GCD(a, b)=1 then a and b are relatively primes.  Ex: GCD(8,15)=1 so 8 and 15 are relatively primes. GCD(greatest common divisor) Logic in C: int n1, n2, i, gcd; printf("Enter two integers: "); scanf("%d %d", &n1, &n2); for(i=1; i <= n1 && i <= n2; ++i) { // Checks if i is factor of both integers if(n1%i==0 && n2%i==0) gcd = i; } printf("G.C.D of %d and %d is %d", n1, n2, gcd);
  • 4.  12 and 15 are not relatively primes.  12 factors=> 1,2,3, 4,6 15 factors=> 1,3,5 1 2 3 4 6 5 GCD(12,15) = 3 !=1 so 12 and 15 are not relative primes
  • 5.  Properties of Primes:  Prime Pairs: Many primes occur in pairs on either side of an even integer.  Ex: 2,3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97  Mersenne prime: prime that can be expressed as 2p-1 where p is a prime number.  Note that having the form of 2p-1 does not guarantee that the number is prime. 211-1=2047 is not a prime number; its prime factorization is 23 * 89 Perfect Number: A perfect number is an integer > 1 which meets the condition that the sum of its positive divisors exclusive of the number itself is equal to the number. Ex: 6 = 1+2+3, 28= 1+2+4+7+14, 496 and 8128 The Goldbach Conjecture : every even number could be expressed as the sum of two prime numbers. For example, 6 = 3 + 3, 20 = 17 + 3, etc. .
  • 6.  Modular arithmetic is a special type of arithmetic that involves only integers.  When we divide two integers we will have an equation that looks like the following:  A/B=Q remainder R  A is the dividend B is the divisor Q is the quotient R is the remainder  Sometimes, we are only interested in what the remainder is when we divide AAAby BBB. Modular Arithmetic
  • 7.  When we will use mod(%):  To determine remaining after sharing some quantity to some people or things.  Example: if you have 7 rupees and 3 people. When you share 7 rupees to 3 people. Every one will get equal amount of money. Each will get 2 rupees.(2*3). Reaming money is remainder (1 rupee)  7/3=2 reminder is 1.  To get remainder we need to use mod(%) operator.  Visualization of Clock: For example, a clock with the 12 replaced by a 0 would be the circle for a modulus of 12.
  • 8.  To find the result of A mod B, we can follow these steps:  Construct this clock for size B  Start at 0 and move around the clock A steps  Wherever we land is our solution.  (If the number is positive we step clockwise, if it's negative we step counter-clockwise.)  M mod N=> M numbers, from the range of 0 and N-1.  8 mode 4=?  8 numbers from 0,1,2,3 in clock wise direction.  => 1,2,3,0,1,2,3,0
  • 9.  7 mode 2=?  7 numbers from 0,1 in clockwise direction  => 1,0,1,0,1,0,1.  -5 mode 3=?  5 numbers from 0,1,2 in anti clock wise direction  => 2,1,0,2,1  If we have A mod B and we increase A by a multiple of B, we will end up in the same spot, i.e. A mod B=(A+K⋅B) mod B for any integer K.
  • 10.  Symmetric Encryption Disadvantages: 1. common key is need to use at sender and receiver for encryption and decryption. 2. Algorithms for both encryption and decryption are fixed and known to everyone. 3. No message can be sent unless there has been some prior agreement on a key. 4. Even if there is an agreement, if the same key is used over an extended period of time, an eavesdropper may be able to infer the key and break the code.  RSA algorithm [Rivest , Shamir and Adleman] in 1978: RSA Algorithm
  • 11.  To avoid the Symmetric Encryption algorithm Issues, introduced Asymmetric algorithms(like RSA) which uses public key and private key concept in Cryptography.  New keys must be transmitted between the senders and receivers to avoid code breaking.  The most widely used public key system is the RSA algorithm.  We assume that Bob and Alice wish to exchange secure messages and that Eve is attempting to eavesdrop.
  • 12.  Assume that Alice wants to send a message to Bob. Then • Bob chooses a private key known only to him. Bob exploits a function f to compute his public key, public = f(private). • Bob publishes public key. • Alice exploits Bob’s public key to compute cipher text= encrypt(plaintext, public) and she sends cipher text to Bob. • Bob exploits his private key to compute plaintext= decrypt(cipher text, private). In order for this last step to work, encrypt and decrypt must be designed so that one is the inverse of the other. • If there exist efficient algorithm for performing all four of the steps, then Bob and Alice will be able to exchange messages. • We assume that Eve knows the algorithm encrypt and decrypt . So she could easily eavesdrop if she could infer Bob’s private key from his public one or if she could compute decrypt without knowing Bob’s private key. • RSA algorithm uses the mathematical properties of modular arithmetic and the computational properties of prime numbers to ensure that Bob and Alice can perform their tasks efficiently but Eve cannot.
  • 13.  RSA Algorithm(for small numbers between 0 to 20) 1 select two prime numbers p=3, q=7 2 Calculate first part of public key ( which generated by bob to share to alisa) n=p*q=(3)*(7)=21 3 Find other part of the public key e. e stands for encrypt e=2 phi=(p-1)*(q-1)=(3-1)*(7-1)=2*6=12 E must be co-prime to phi and smaller than phi. e=5 while(e<phi) { if(GCD(e,phi)==1) { break; } e++; } 4 Generate private key d //Private key (d stands for decrypt) // choosing d such that it satisfies // d*e = 1 + k * totient now e=5, d=5 int k = 2; // A constant value double d = (1 + (k*phi))/e; = (1 + (2*12))/5 = 25/5 5 c=(msg^e)%n d=(c^d)%n =(12^5)%5=3 = (3^5)%5 = 12
  • 14. • Select 2 prime numbers -> p=17 and q=11 • Calculate n = p×q =17 ×11=187 • Calculate = 16 × 10= 160 Select ‘e’ such that e is relatively prime to (n)=160 and e < 160 • Determine d such that : de =1 mod (n) d × 7 = 1 mod 160 ↓ 161 • d= (e^-1) mod n [161/7= div.(d)23 and remainder (mod) =1 • d=23 1.Then the resulting keys are public key : PU = {7, 187 } PR = {23, 187 } Sample RSA Algorithm
  • 15. • Let Plain text message(M)=88 for encryption Cipher Text(C) = (M^e)%n = (88^7)%187 = (88^4 * 88^2 * 88^1)%187 = 59969536%187 * 7744%187 * 88%187 = 132 * 77 * 88 = 894432%187 = 11 • For Decryption : Plain text M= (C^d)%n = (11^23)%187 => (24= 8+8+4+2+1) = (11^8 * 11^8 * 11^4 * 11^2 * 11^1) % 187 = (214358881%187 * 214358881%187 * 14641%187 * 121%187 *11%187 = 33 * 33 * 55 * 121 * 11 = 79720245 %187 = 88
  • 16.  Let ”p” be a prime number, and ” a” any integer. Then ap -a is always divisible by ”p”. Example : a=2, p=7 2^7-2=128-2=126/7=18 reminder “0” so 2^7-2 is divisible by 7. In modular arithmetic notation, this can be written as Fermat’s Little theorem
  • 17. • Euler Totient Function: (n) • (n) = how many numbers there are between 1 and n-1 that are relatively prime to n. • (4) = 2 (1, 3 are relatively prime to 4) • (5) = 4 (1, 2, 3, 4 are relatively prime to 5) • (6) = 2 (1, 5 are relatively prime to 6) • (7) = 6 (1, 2, 3, 4, 5, 6 are relatively prime to 7) • As you can see from (5) and (7), (n) will be n-1 whenever n is a prime number. This implies that (n) will be easy to calculate when n has exactly two different prime factors: (P * Q) = (P-1)*(Q-1), if P and Q are prime. Euler's Theorem           
  • 18. • This theorem generalizes Fermat’s theorem and is an important key to the RSA algorithm. • If GCD(a, p) = 1, and a < p, then a (p) 1(mod p). • In other words, If a and p are relatively prime, with a being the smaller integer, then when we multiply a with itself (p) times and divide the result by p, the remainder will be 1. • Let’s test the theorem: If a = 5 and p = 6 Then (6) = (2-1) * (3-1) = 2 So, 5 (6) = 25 and 25 = 24+1 = 6*4+1 => 25 = 1(mod 6) OR 25 % 6 = 1 It also follows that a (p)+1 a(mod p) so that p does not necessarily need to be relatively prime to a.  
  • 19.  Euler’s theorem uses modulus arithmetic which helps to lay the foundation for RSA encryption. To construct a personal cipher key we need an appropriate value we will call variable R. So, we select two very large prime numbers U and V and multiply them.  => (R) = (U-1)*(V-1). This makes R difficult to factor, since the fewer factors a number has, the longer it takes to find them  We also define the variables P and Q. P is an arbitrary number that is relatively prime to (R). Q is the calculated inverse of P in (mod (R)).  We use P and R to create a public key, and Q and R to create a private key.  This yields P*Q = 1(mod (R) ).  The result is that too much information is lost in the encryption due to the modulus arithmetic to decipher a privately encrypted RSA message without the use of the public key. Unless the would-be decipherer had enough time and processing power to attempt a brute-force factorization. But, the larger the primes, the longer it takes to factor their product.    
  • 20. • Chinese Remainder Theorem: Let m1, m2, . . . , mn be pairwise relatively prime positive integers, • i.e., gcd(mi , mj ) = 1 for i != j. The system • x ≡ a1 (mod m1) • x ≡ a2 (mod m2) . . . • x ≡ an (mod mn) • has a unique solution solution modulo m = m1m2 · · · mn, i.e., there is a unique solution x with 0 ≤ x < m. Furthermore, all solutions are congruent modulo m. Chinese Reminder Theorem
  • 21. • We can construct a solution as follows. 1. Let m = m1m2 · · · mn. 2. Let Mk = m mk for all k = 1, 2, . . . , n. 3. For all k = 1, 2, . . . , n, find integers yk such 1. Mkyk ≡ 1 (mod mk). Since gcd(Mk, mk) = 1, we know that yk exists. Euclid’s extended algorithm can be used to find yk. 1. The integer a1M1y1 + a2M2y2 + · · · + anMnyn is a solution of the system. 2. The integer x = (a1M1y1 + a2M2y2 + · · · + anMnyn) mod m is the unique solution with 0 ≤ x < m.
  • 22. • For example, let’s find the smallest positive integer x such that • x ≡ 2 (mod 3) • x ≡ 5 (mod 7) • x ≡ 8 (mod 11) 1. m = 3(7)(11) = 231. 2. M1 = 231/3 = 77, M2 = 231/7 = 33, M3 = 231/11 = 21. 3. We now find y1, y2, and y3. 1. 77y1 ≡ 1 (mod 3) −→ y1 = 2 2. 33y2 ≡ 1 (mod 7) −→ y2 = 3 3. 21y3 ≡ 1 (mod 11) −→ y3 = 10 4. The smallest positive integer solution is then x = (a1M1y1 + a2M2y2 + a3M3y3) mod m = (2(77)(2) + 5(33)(3) + 8(21)(10)) mod 231 = 2483 mod 231 = 173.
  • 23. • The goal of exponentials is to calculate the product x:23 • The goal of logarithm is to calculate the exponent: x=log2(8) (8=2x) • In the discrete algorithm, you need to apply modulo operation in later • X=log28 (mod 13) • Other way of notation: x= dlog2,13(8) • Where: x= exponent, 2=base, 13=modulus, 8= reminder • Simple way of the above notation • 8=2x(mod 13) Discrete logarithm
  • 24. • Example: • 2x (mod 7) = 4 • Let us consider x={1..6} • X=2 or 5 satisfy above statement • 4 (mod 7) = 4 and 32 (mod 7) = 4 • There are two solutions. In the world of cryptography we are only interested in discrete logarithms which each exponent have distinct reminder. • It seems that if the modulus (p) is prim number there are certain base values (b) which generate distinct remainders for different exponents(x=1,…,p-1)
  • 25.  Lets calculate bx (mod 7) = remainder x={1,…,6} modulus p=7 • The discrete logarithm for modulus 7 generates distinct reminders when using base value 3 or 5 and the reminders are in the range {1,…,6} b b1mod7 b2mod 7 b3mod 7 b4mod 7 b5mod 7 b6mod 7 1 1 1 1 1 1 1 2 2 4 1 2 4 1 3 3 2 6 4 5 1 4 4 2 1 4 2 1 5 5 4 6 2 3 1 6 6 1 6 1 1 1
  • 26. • The base value 3 and 5 are called the primitive roots of 7 or generators, often indicated by symbol . It is called generator because applying the multiplication operation on one single element , generates all elements in the discrete group {1, … , p-} • Calculating 311 mod 17=x is very easy, but doing the opposite, calculating the discrete logarithm 11=3x mod 17 is very difficult. Especially if the modulus is at least 309 digits long. • To solve 11=3x mod 17 a computer needs to try each exponent x=0,1,2, .. until the equation matches.
  • 27. • This is called a cyclic group of generator . After a certain number of exponentiations and modulus operations. We have loop. • If the remainder has value 1, the cycle starts all over again in the same order.