95-702 Distributed Systems1 Lecture 12: RSA. 95-702 Distributed Systems2 Plan for today: Introduce RSA and a toy example using small numbers. This is.

Slides:



Advertisements
Similar presentations
Requirements for a Secure Voting System  Only authorized voters can vote  No one can vote more than once  No one can determine for whom anyone else.
Advertisements

Digital Signatures Good properties of hand-written signatures: 1. Signature is authentic. 2. Signature is unforgeable. 3. Signature is not reusable (it.
Digital Signatures and Hash Functions. Digital Signatures.
Public Key Encryption Algorithm
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 29 Cryptography and Network.
OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
Dr Alejandra Flores-Mosri Message Authentication Internet Management & Security 06 Learning outcomes At the end of this session, you should be able to:
Public Key Crytography1 From: Introduction to Algorithms Cormen, Leiserson and Rivest.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.
1 Lecture #10 Public Key Algorithms HAIT Summer 2005 Shimrit Tzur-David.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Public Key Algorithms 4/17/2017 M. Chatterjee.
Public Key Cryptography RSA Diffie Hellman Key Management Based on slides by Dr. Lawrie Brown of the Australian Defence Force Academy, University College,
CSCI 172/283 Fall 2010 Public Key Cryptography. New paradigm introduced by Diffie and Hellman The mailbox analogy: Bob has a locked mailbox Alice can.
Codes, Ciphers, and Cryptography-RSA Encryption
Computer Science Public Key Management Lecture 5.
Introduction to Public Key Cryptography
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.
Sorting Out Digital Certificates Bill blog.codingoutloud.com ··· Boston Azure ··· 13·Dec·2012 ···
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
The RSA Algorithm Rocky K. C. Chang, March
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Network Security (A Very Brief Introduction)
Computer Science 101 Cryptography Part II
Network and Communications Network Security Department of Computer Science Virginia Commonwealth University.
Lecture 19 Page 1 CS 111 Online Symmetric Cryptosystems C = E(K,P) P = D(K,C) E() and D() are not necessarily the same operations.
RSA Implementation. What is Encryption ? Encryption is the transformation of data into a form that is as close to impossible as possible to read without.
Cryptography: RSA & DES Marcia Noel Ken Roe Jaime Buccheri.
10/1/2015 9:38:06 AM1AIIS. OUTLINE Introduction Goals In Cryptography Secrete Key Cryptography Public Key Cryptograpgy Digital Signatures 2 10/1/2015.
Encryption Coursepak little bit in chap 10 of reed.
Symmetric versus Asymmetric Cryptography. Why is it worth presenting cryptography? Top concern in security Fundamental knowledge in computer security.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Public-Key Cryptography CS110 Fall Conventional Encryption.
Midterm Review Cryptography & Network Security
6. Esoteric Protocols secure elections and multi-party computation Kim Hyoung-Shick.
Chapter 31 Cryptography And Network Security Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
1 Public-Key Cryptography and Message Authentication.
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
IELM 511: Information System design Introduction Part 1. ISD for well structured data – relational and other DBMS Part 2. ISD for systems with non-uniformly.
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Advanced Database Course (ESED5204) Eng. Hanan Alyazji University of Palestine Software Engineering Department.
1 Introduction The State of the Art in Electronic Payment Systems, IEEE Computer, September 1997.
IT 221: Introduction to Information Security Principles Lecture 4: Public-Key Cryptography For Educational Purposes Only Revised: September 15, 2002.
Public Key Cryptosystems RSA Diffie-Hellman Department of Computer Engineering Sharif University of Technology 3/8/2006.
A A E E D D C C B B # Symmetric Keys = n*(n-1)/2 F F
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
POON TENG HIN.  RSA  Shamir’s Three-Pass Protocol  Other issues.
PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 Principles Applications Requirements RSA Algorithm Description.
Fall, Privacy&Security - Virginia Tech – Computer Science Click to edit Master title style Cryptographic Security Identity-Based Encryption.
1 Thuy, Le Huu | Pentalog VN Web Services Security.
CS 4803 Fall 04 Public Key Algorithms. Modular Arithmetic n Public key algorithms are based on modular arithmetic. n Modular addition. n Modular multiplication.
Introduction to Cryptography Lecture 9. Public – Key Cryptosystems Each participant has a public key and a private key. It should be infeasible to determine.
Chapter 12: Cryptography MAT 320 Spring Cryptography: Basic Ideas We want to encode information so that no one other than the intended recipient.
ECE Prof. John A. Copeland fax Office: GCATT Bldg.
RSA Cryptosystem Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 8Feb. 09, 2006Carnegie Mellon University.
SOA Seminar1 Seminar on Service Oriented Architecture RSA.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Intro to Cryptography ICS 6D Sandy Irani. Cryptography Intro Alice wants to send a message to Bob so that even if Eve can see the transmitted information,
Department of Computer Science Chapter 5 Introduction to Cryptography Semester 1.
Digital Signatures.
Public Key Encryption Major topics The RSA scheme was devised in 1978
Chapter 3 - Public-Key Cryptography & Authentication
Chapter 29 Cryptography and Network Security
Presentation transcript:

Distributed Systems1 Lecture 12: RSA

Distributed Systems2 Plan for today: Introduce RSA and a toy example using small numbers. This is from Introduction to Algorithms by Cormen, Leiserson and Rivest Describe an interesting cryptographic protocol and its limitations. This is from Applied Cryptography by Bruce Schneier. Show how RSA cryptography can be done in Java. See the Java Cryptograhy API.

Distributed Systems3 Privacy: to send encrypted messages over an insecure channel. Authentication: To digitally sign messages. RSA was not the first public key approach. Public key cryptography was first introduced by Diffie and Hellman in RSA was developed by Rivest, Shamir, and Aldeman in It’s probably safe to call public key cryptography revolutionary. Purpose of RSA

Distributed Systems4 The Cast of Characters Eve - tries to view messages she should not be viewing. Mallory - tries to manipulate messages and be disruptive. Bob and Alice - try to communicate over insecure channels.

Distributed Systems5 1.Select at random two large prime numbers p and q. These numbers would normally be about 500 digits in length. 2.Compute n by the equation n = p X q. 3.Compute  (n) = (p –1) X (q –1) 4.Select a small odd integer e that is relatively prime to  (n) The RSA Key Generation (1)

Distributed Systems6 5. Compute d as the multiplicative inverse of e modulo  (n). A theorem in number theory asserts that d exists and is uniquely defined. 6. Publish the pair P = (e,n) as the RSA public key. 7. Keep secret the pair S = (d,n) as the RSA secret key. The RSA Key Generation (2)

Distributed Systems7 8. To encrypt a message M compute C = M e (mod n) 9. To decrypt a message C compute M = C d (mod n) RSA Encryption and Decryption

Distributed Systems8 Toy Example: Key Selection(1) 1.Select at random two large prime numbers p and q. These numbers would normally be about 500 digits in length. p = 3 q = 11 2.Compute n by the equation n = p X q. n = Compute  (n) = (p –1) X (q –1)  (n) = (2) X (10) = 20

Distributed Systems9 Toy Example: Key Selection(2) 4. Select a small odd integer e that is relatively prime to  (n) p = 3 q = 11 n = 33  (n) = 20 e = 3

Distributed Systems10 Toy Example: Key Selection(3) 5. Compute d as the multiplicative inverse of e, modulo  (n). A theorem in number theory asserts that d exists and is uniquely defined (since e and  (n) are relatively prime). We need a d so that ed mod  = 1 Let’s try 1. 3 X 1 mod 20 = 3 mod 20 = 3. Nope. p = 3 q = 11 n = 33  (n) = 20 e = 3

Distributed Systems11 Toy Example: Key Selection(4) We need a d so that ed mod  = 1 Let’s try 2. 3 X 2 mod 20 = 6 mod 20 = 6. Nope. Let’s try 7. 3 X 7 mod 20 = 21 mod 20 = 1. We found it! This approach is too slow. A fast approach exists. p = 3 q = 11 n = 33  (n) = 20 e = 3

Distributed Systems12 Toy Example: Publish The Public Key 6. Publish the pair P = (e,n) as the RSA public key. “Hey everyone, my key pair is 3 and 33” 7. Keep secret the pair S = (d,n) as the RSA secret key. “I’m not telling anyone about 7 and 33!!” p = 3 q = 11 n = 33  (n) = 20 e = 3 d = 7

Distributed Systems13 Toy Example: Message encoding phase e = 3 n = 33Bob’s public keys are Alice wants to send the letter ‘d’ to Bob. Suppose that we have a public code where ‘a’ = 0 ‘b’ = 1 ‘c’ = 2 ‘d’ = 3 and so on… Alice’s software knows that 8. To encrypt a message M compute C = M e (mod n) = 3 3 mod 33 = 27 mod 33 = 27

Distributed Systems14 Toy Example: Message decoding phase d = 7 n = 33Bob’s private keys are Bob receives a 27 from Alice: 9. To decrypt a message C compute M = C d (mod n) = 27 7 mod 33 = mod 33 = 3 (which is ‘d’)

Distributed Systems15 An Example - Secure Voting We want to think about: Business Requirements Cryptographic protocols Threat models

Distributed Systems16 Goals Of Secure Voting Only Authorized Voters Can Vote No one can vote more than once No one can determine for whom anyone else voted No one can duplicate anyone else’s vote No one can change anyone else’s vote without being discovered Every voter can make sure that his vote has been taken into account in the final tabulation.

Distributed Systems17 First Attempt Each voter encrypts his vote with the public key of a Central Tabulating Facility (CTF) Each voter send his vote in to the CTF The CTF decrypts the votes, tabulates them, and makes the results public What are some problems with this protocol?

Distributed Systems18 Second Attempt Each voter signs his vote with his private key Each voter encrypts his signed vote with the CTF’s public key Each voter send his vote to the CTF The CTF decrypts the votes, checks the signature, tabulates the votes and makes the results public What are some problems with this protocol?

How do we do RSA in Java? Distributed Systems19

RSA In Java(1) How do I create RSA keys? Use the Biginteger class and do your own calculations or Use Java’s keytool: keytool -genkey -alias mjm -keyalg RSA -keystore mjmkeystore Distributed Systems20

RSA In Java(2) How do I read the RSA keys from a keystore? String keyFileName = "coolkeys"; String alias = "mjm"; char[] passWord = "sesame".toCharArray(); FileInputStream fis = new FileInputStream(keyFileName); KeyStore keyStore = KeyStore.getInstance("JKS"); System.out.println("Load key store with file name and password"); keyStore.load(fis, passWord); Distributed Systems21

RSA In Java(3) How do I decrypt encrypted data with the private key? RSAPrivateKey RSAKey = (RSAPrivateKey)keyStore.getKey(alias,passWord); Cipher RSACipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); RSACipher.init(Cipher.DECRYPT_MODE, RSAKey); byte decryptedKeyBytes[] = RSACipher.doFinal(encryptedBlowFishKey); Distributed Systems22

RSA In Java(4) How do I generate a certificate? Use the keytool and the keystore: keytool -export -alias mjm -keystore mjmkeystore –file cool.cer Distributed Systems23

RSA In Java(5) How do I read the public key from the certificate? CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); FileInputStream fis = new FileInputStream("cool.cer"); Certificate cert = certFactory.generateCertificate(fis); fis.close(); PublicKey pub = cert.getPublicKey(); Distributed Systems24

RSA In Java(6) How do I encrypt with the public key? Cipher cipherPub = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipherPub.init(Cipher.ENCRYPT_MODE, pub); byte encryptedBlowFish[] = cipherPub.doFinal(blowFishKeyBytes); Distributed Systems25