Information and Computer Security CPIS 312 Lab 8 1 Asymmetric Key Algorithms RSA Algorithm TRIGUI Mohamed Salim.

Slides:



Advertisements
Similar presentations
RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
Advertisements

IS 302: Information Security and Trust Week 4: Asymmetric Encryption
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (4) Information Security.
CSE331: Introduction to Networks and Security Lecture 19 Fall 2002.
Public Key Cryptosystems - RSA Receiver Sender Eavesdroppe r p q p q p q p and q prime.
Data encryption with big prime numbers
22C:19 Discrete Structures Integers and Modular Arithmetic
Public Key Encryption Algorithm
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Public Key Cryptography
Public Encryption: RSA
8: Network Security8-1 Symmetric key cryptography symmetric key crypto: Bob and Alice share know same (symmetric) key: K r e.g., key is knowing substitution.
“RSA”. RSA  by Rivest, Shamir & Adleman of MIT in 1977  best known & widely used public-key scheme  RSA is a block cipher, plain & cipher text are.
Codes, Ciphers, and Cryptography-RSA Encryption
Asymmetric encryption. Asymmetric encryption, often called "public key" encryption, allows Alice to send Bob an encrypted message without a shared secret.
The RSA Algorithm Based on the idea that factorization of integers into their prime factors is hard. ★ n=p . q, where p and q are distinct primes Proposed.
 Introduction  Requirements for RSA  Ingredients for RSA  RSA Algorithm  RSA Example  Problems on RSA.
Elgamal Public Key Encryption CSCI 5857: Encoding and Encryption.
Prime Numbers Prime numbers only have divisors of 1 and self
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
RSA Public Key Algorithm. RSA Algorithm history  Invented in 1977 at MIT  Named for Ron Rivest, Adi Shamir, and Len Adleman  Based on 2 keys, 1 public.
RSA and its Mathematics Behind
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
Public-Key Cryptography CS110 Fall Conventional Encryption.
Midterm Review Cryptography & Network Security
Implementing RSA Encryption in Java
Improving Encryption Algorithms Betty Huang Computer Systems Lab
Introduction to Algorithms Second Edition by Cormen, Leiserson, Rivest & Stein Chapter 31.
Day 37 8: Network Security8-1. 8: Network Security8-2 Symmetric key cryptography symmetric key crypto: Bob and Alice share know same (symmetric) key:
Cryptography Wei Wu. Internet Threat Model Client Network Not trusted!!
Darci Miyashiro Math 480 April 29, 2013
Public-Key Encryption
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
What is RSA RSA is a system employed to create the encrypted message in which the key used for encryption is different from that used to decrypt. It is.
Public Key (RSA) Day 27. Objective Students will be able to… …understand how RSA is used for encryption and decryption. …understand some of the challenges.
RSA Prepared by: SITI ZAINAH ADNAN
CSC 386 – Computer Security Scott Heggen. Agenda Exploring that locked box thing from Friday?
Algebra of RSA codes Yinduo Ma Tong Li. Ron Rivest, Adi Shamir and Leonard Adleman.
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
1 Simple and Unbreakable: The Mathematics of Internet Security Dr. Monica Nevins Department of Mathematics and Statistics University of Ottawa University.
RSA and its Mathematics Behind July Topics  Modular Arithmetic  Greatest Common Divisor  Euler’s Identity  RSA algorithm  Security in RSA.
PUBLIC KEY CRYPTOGRAPHY ALGORITHM Concept and Example 1IT352 | Network Security |Najwa AlGhamdi.
22C:19 Discrete Structures Integers and Modular Arithmetic Fall 2014 Sukumar Ghosh.
Network Security Lecture 18 Presented by: Dr. Munam Ali Shah.
RSA The algorithm was publicly described in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman at MIT Partly used for PGP (Pretty Good Privacy) to encrypt.
ENCRYPTION TAKE 2: PRACTICAL DETAILS David Kauchak CS52 – Spring 2015.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues.
CS Modular Division and RSA1 RSA Public Key Encryption To do RSA we need fast Modular Exponentiation and Primality generation which we have shown.
Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy.
DIGITAL SIGNATURE IMPLEMENTATION
Primality Testing. Introduction The primality test provides the probability of whether or not a large number is prime. Several theorems including Fermat’s.
Lecture 3 (Chapter 9) Public-Key Cryptography and RSA Prepared by Dr. Lamiaa M. Elshenawy 1.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
Data encryption with big prime numbers DANIEL FREEMAN, SLU.
Elgamal Public Key Encryption CSCI 5857: Encoding and Encryption.
Breaking Cryptosystems Joshua Langford University of Texas at Tyler Fall 2007 Advisor: Dr. Ramona Ranalli Alger.
CS/COE 1501 Recitation RSA Encryption/Decryption Extended Euclidean Algorithm Digital Signatures.
Information and Computer Security CPIS 312 Lab 1
CPIS 312 Chapter Four: PUBLIC KEY CRYPTO. Index 2 A.Introduction A.1 Asymmetric Key Cryptography- Introduction A.2 General ideas about the Public Key.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
Revision. Cryptography depends on some properties of prime numbers. One of these is that it is rather easy to generate large prime numbers, but much harder.
Encryption Take 2: Practical details
Public Key Cryptography
Public Key Encryption.
Information and Computer Security CPIS 312 Lab 2
Public Key Cryptosystems - RSA
Rivest, Shamir and Adleman
Analysis of the RSA Encryption Algorithm
Information and Computer Security CPIS 312 Lab 3
Presentation transcript:

Information and Computer Security CPIS 312 Lab 8 1 Asymmetric Key Algorithms RSA Algorithm TRIGUI Mohamed Salim

1. Using RSA algorithm to Encrypt and Decrypt plaintext. 2. Learn how to achieve RSA algorithm parameters using some calculations, predefined procedures, and user defined in procedures. 3. Trying to adjust RSA by using different tactics 2 Lab Objectives

1. Students will be able to use RSA to encrypt and decrypt plaintext. 2. Students will be able to calculate different RSA parameters such as : A. Calculating E ( encryption parameter) B. Calculating D ( decryption parameter) C. Calculating GCD ( greatest common divisor) 3 Lab Outcomes

4 Data Encryption Standard (RSA) RSA Pseudo code: - Select P, Q where P and Q are prime numbers, P ≠Q - Calculate n, where n = P * Q - Calculate Ф (n), where Ф (n) = (P-1)(Q-1) - Select Random E such as : gcd (Ф (n), E) = 1 1<E< Ф (n), - Calculate D, where d.e ≡ 1 (mod φ(n)) - Public key {E,n} - private key {D,n}

5 Example 1 Use RSA algorithm to encrypt the following text number: Plaintext: 88 - Select P = 17, Q = 11 - Calculate n, n = 17 *11 = Calculate Ф (n), 16 * 10 = Select Random E such as: gcd (E, Ф (n),) = 1 1<E< Ф (n), E = 7 because gcd (7,160) = 1

6 Example 1 - Calculate D, where d.e ≡ 1 (mod φ(n)) D * 7 ≡ 1 mod 160 D = 23 - Public key { 187, 7} - private key {187, 23}

7 Example 1 Encryption: c = m e mod n 88 7 mod 187=11=Cipher Decryption: m = c d mod n mod 187 = 88

8 Example 2 Select primes p=11, q=3. n = p.q = 11.3 = 33 phi = (p-1)(q-1) = 10.2 = 20 Choose e=3, gcd(e, phi)= gcd(3, 20)= gcd(20, 2) = gcd(2, 0)=1 (This means that 3 and 20 are coprime)

9 Example 2 Compute d such that ed ≡ 1 (mod phi) Simple testing (d = 1, 2,...) gives d = 7 Check: ed-1 = = 20, which is divisible by phi. Public key = (n, e) = (33, 3) Private key = (n, d) = (33, 7).

10 Example 2 Now say we want to encrypt the message m = 7, c = m e mod n = 7 3 mod 33 = 343 mod 33 = 13. To check decryption we compute m = c d mod n = 13 7 mod 33 = 7. a = bc mod n = (b mod n).(c mod n) mod n

11 Hint that help in implementation 1. Modular Exponentiation routine /* return x^n (mod p) Assume x, n > = 0, p>0, x < p, 0^0 = 1 */ Public static long power (long x, long n, long p) { If (n ==0) {return 1 ;} long tmp = power( (x*x)%p, n/2, p ); if ( n% 2 != 0) { tmp = (tmp*x)% p ;} return tmp; }

12 Hint that help in implementation 2. Greatest common divisor /* Return the Greatest common divisor */ public static long gcd( long a, long b ) { if (b==0) return a; else return gcd ( b, a%b); }

13 Homework You intercept a message encrypted using RSA with value C = 10. You know that the message is intended for a user whose public key is {e=5, n=35}. Find the plaintext M. Hint: Factorize n to find p and q. Use e*d*mod ø(n) = 1 and trial and error to find d