CS/COE 1501 Recitation RSA Encryption/Decryption Extended Euclidean Algorithm Digital Signatures.

Slides:



Advertisements
Similar presentations
Public Key Cryptosystem
Advertisements

RSA COSC 201 ST. MARY’S COLLEGE OF MARYLAND FALL 2012 RSA.
Data Security 1 El_Gamal Cryptography. Data Security2 Introduction El_Gamal is a public-key cryptosystem technique El_Gamal is a public-key cryptosystem.
CS 483 – SD SECTION BY DR. DANIYAL ALGHAZZAWI (4) Information Security.
Asymmetric-Key Cryptography
22C:19 Discrete Structures Integers and Modular Arithmetic
Public Key Encryption Algorithm
22C:19 Discrete Math Integers and Modular Arithmetic Fall 2010 Sukumar Ghosh.
Lecture 3.3: Public Key Cryptography III CS 436/636/736 Spring 2012 Nitesh Saxena.
7. Asymmetric encryption-
and Factoring Integers (I)
Attacks on Digital Signature Algorithm: RSA
HW6 due tomorrow Teams T will get to pick their presentation day in the order Teams T will get to pick their presentation day in the orderQuestions? Review.
RSA ( Rivest, Shamir, Adleman) Public Key Cryptosystem
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
Kemal AkkayaWireless & Network Security 1 Department of Computer Science Southern Illinois University Carbondale CS 591 – Wireless & Network Security Lecture.
Pass in HW6 now Can use up to 2 late days Can use up to 2 late days But one incentive not to burn them all: teams will get to pick their presentation day.
Public Encryption: RSA
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
ELECTRONIC PAYMENT SYSTEMSFALL 2001COPYRIGHT © 2001 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
Public Key Cryptography RSA Diffie Hellman Key Management Based on slides by Dr. Lawrie Brown of the Australian Defence Force Academy, University College,
CPE5021 Advanced Network Security --- Advanced Cryptography: RSA and its implementation --- Lecture 1.1 Last lecture we saw the data encryption standard.
Computer Science CSC 474Dr. Peng Ning1 CSC 474 Information Systems Security Topic 2.5 Public Key Algorithms.
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.
Public Key Model 8. Cryptography part 2.
 Introduction  Requirements for RSA  Ingredients for RSA  RSA Algorithm  RSA Example  Problems on RSA.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Csci5233 Computer Security1 Bishop: Chapter 10 Key Management: Digital Signature.
Rachana Y. Patil 1 1.
CS5204 – Fall Cryptographic Security Presenter: Hamid Al-Hamadi October 13, 2009.
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 9: Cryptography.
The RSA Algorithm Rocky K. C. Chang, March
Elgamal Public Key Encryption CSCI 5857: Encoding and Encryption.
Lecture 3.2: Public Key Cryptography II CS 436/636/736 Spring 2014 Nitesh Saxena.
Introduction to Modular Arithmetic and Public Key Cryptography.
RSA and its Mathematics Behind
HW6 due tomorrow Teams T will get to pick their presentation day in the order Teams T will get to pick their presentation day in the order Teams mostly.
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
Prelude to Public-Key Cryptography Rocky K. C. Chang, February
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
Public-Key Cryptography CS110 Fall Conventional Encryption.
By Yernar.  Background  Key generation  Encryption  Decryption  Preset Bits  Example.
Modular Arithmetic with Applications to Cryptography Lecture 47 Section 10.4 Wed, Apr 13, 2005.
Darci Miyashiro Math 480 April 29, 2013
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
RSA Slides by Kent Seamons and Tim van der Horst Last Updated: Oct 1, 2013.
The RSA Algorithm. Content Review of Encryption RSA An RSA example.
RSA and its Mathematics Behind July Topics  Modular Arithmetic  Greatest Common Divisor  Euler’s Identity  RSA algorithm  Security in RSA.
A A E E D D C C B B # Symmetric Keys = n*(n-1)/2 F F
Lecture 6.1: Misc. Topics: Number Theory CS 250, Discrete Structures, Fall 2011 Nitesh Saxena.
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.
Public Key Cryptosystem Introduced in 1976 by Diffie and Hellman [2] In PKC different keys are used for encryption and decryption 1978: First Two Implementations.
Ch1 - Algorithms with numbers Basic arithmetic Basic arithmetic Addition Addition Multiplication Multiplication Division Division Modular arithmetic Modular.
Introduction to Cryptography Lecture 9. Public – Key Cryptosystems Each participant has a public key and a private key. It should be infeasible to determine.
CS/COE 1501 Recitation Extended Euclidean Algorithm + Digital Signatures.
Introduction to Elliptic Curve Cryptography CSCI 5857: Encoding and Encryption.
Elgamal Public Key Encryption CSCI 5857: Encoding and Encryption.
Cryptographic Security Aveek Chakraborty CS5204 – Operating Systems1.
RSA Cryptosystem Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 8Feb. 09, 2006Carnegie Mellon University.
Public Key Cryptosystem In Symmetric or Private Key cryptosystems the encryption and decryption keys are either the same or can be easily found from each.
Information and Computer Security CPIS 312 Lab 8 1 Asymmetric Key Algorithms RSA Algorithm TRIGUI Mohamed Salim.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
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.
CS/COE 1501 Recitation RSA Encryption/Decryption
Presentation transcript:

CS/COE 1501 Recitation RSA Encryption/Decryption Extended Euclidean Algorithm Digital Signatures

Say Alice wants to send a message to Bob 1.Looks up Bob’s public key 2.Convert the message into an integer: m 3.Compute the ciphertext c as: c = m e (mod n) 4.Send c to Bob RSA Encryption

Bob can simply: 1.Compute m as: 2.m = c d (mod n) 3.Convert m into Alice’s message RSA Decryption

What are public/private keys? How messages encrypted? How are messages decrypted? How are keys generated? Why is it secure? RSA Cryptosystem

What are public/private keys? Public Key = (e, n) Private Key = (d, n) How messages encrypted? c = m e (mod n) How are messages decrypted? m = c d (mod n) How are keys generated? RSA Cryptosystem

How are keys generated?

1. Choose two prime number p and q p=3, q=11 2. Compute n = p * q n=3*11=33 3. Compute φ(n) φ(n) = φ(p) * φ(q) = (p - 1) * (q - 1) φ(n)=(3-1)*(11-1)=20 4. Choose e such that 1 < e < φ(n), GCD(e, φ(n)) = 1 i.e., e and φ(n) are co-prime We can choose e=3, verify that 1<3< φ(n) =20, 3 and 20 are co- prime An Example

Encryption: c = m e (mod n) Decryption: m = c d (mod n) Public Key=(e,n)=(3,33) Private Key=(d,n)=(7,33) Alice said “hello” 7, 4, 11, 11, 14 Encrypt msg: 7 3 mod 33, 4 3 mod 33, 11 3 mod 33, 11 3 mod 33, 14 3 mod 33 Encrypted msg: 13, 31, 11, 11, 5 An Example

Encryption: c = m e (mod n) Decryption: m = c d (mod n) Public Key=(e,n)=(3,33) Private Key=(d,n)=(7,33) Bob receive 13, 31, 11, 11, 5 Decrypt msg: 13 7 mod 33, 31 7 mod 33, 11 7 mod 33, 11 7 mod 33, 5 7 mod 33 Decrypt msg: 7, 4, 11, 11, 14 -> ‘hello’ An Example

Challenges

d = e -1 mod(φ(n)) Means that d = 1/e mod(φ(n)) Means that e * d = 1 (mod φ(n)) Now, this can be equivalently stated as e * d = z * φ(n) + 1 For some z Can further restate this as: e * d - z * φ(n) = 1 Or similarly: 1 = φ(n) * (-z) + e * d How can we solve this? Hint: recall that we know GCD(φ(n), e) = 1 Determine d

GCD(a, b) = i = as + bt Let: a = φ(n) b = e s = -z t = d i = 1 GCD(φ(n), e) = 1 = φ(n) * (-z) + e * d We can compute d in linear time! Determine d

Extended Euclidean Algorithm

We know GCD(a,b)=GCD(b, a%b) Suppose we are computing the GCD(a,b) a*x + b*y = gcd Suppose we already know the GCD(b, a %b), and we find x 1 and y 1 b*x 1 +(a%b)*y 1 =gcd Associate the two formular a%b=a-(a/b)*b gcd= b*x 1 +(a-(a/b)*b)*y 1 = b*x 1 +a*y 1 -(a/b)*b*y 1 = a*y 1 +b*(x 1 -a/b*y 1 ) x=y 1 y=x 1 -a/b*y 1 Extended Euclidean Algorithm

public static int[] ExtendedEuclid(int a, int b) { int[] ans = new int[3]; int q; if (b == 0) { /* If b = 0, then we're done... */ ans[0] = a; ans[1] = 1; ans[2] = 0; } else { /* Otherwise, make a recursive function call */ q = a/b; ans = ExtendedEuclid (b, a % b); int temp = ans[1] - ans[2]*q; ans[1] = ans[2]; ans[2] = temp; } return ans; } Extended Euclidean Algorithm

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN

Extended Euclidean Algorithm

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Find the Bézout numbers and GCD of 99 and 78 Rowaba/ba%bdst NaN 310

Exercise

Hash Functions

For Crypto Hash Functions, Output Should Appear Random

Digital Signatures – Public Key Cryptography

Creating a Digital Signature

Digital Signatures Often Use Commutative Operations

Plaintext sent by sender

Digital Signatures Often Use Commutative Operations Plaintext sent by sender Cryptotext sent by sender using sender’s private key

Digital Signatures Often Use Commutative Operations Plaintext sent by sender Cryptotext sent by sender using sender’s private key Sender’s public key

Digital Signatures Often Use Commutative Operations Plaintext sent by sender Cryptotext sent by sender using sender’s private key Sender’s public key =

Digital Signatures Often Use Commutative Operations Plaintext sent by sender Cryptotext sent by sender using sender’s private key Sender’s public key = Plaintext recovered matches

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes Received: HASH ALGORITHM

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes Received: HASH ALGORITHM

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes Received: HASH ALGORITHM Compute

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes Received: HASH ALGORITHM Compute =

Because Public-Key crypto can be computationally expensive, often the crypto operations are performed on the securely hashed version of the message rather than the original: Digital Signatures and Hashes Received: HASH ALGORITHM Compute = Match. Signature Verified.

Adam J. Lee’s slides from CS Acknowledgements