Asymmetric Encryption

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science.
Advertisements

Public Key Crytography1 From: Introduction to Algorithms Cormen, Leiserson and Rivest.
How cryptography is used to secure web services Josh Benaloh Cryptographer Microsoft Research.
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Public Key Model 8. Cryptography part 2.
1 CIS 5371 Cryptography 8. Asymmetric encryption-.
Andreas Steffen, , 4-PublicKey.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen Institute for Internet Technologies and Applications.
Chapter 12 Cryptography (slides edited by Erin Chambers)
Page 1 Secure Communication Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
1 Network Security Lecture 6 Public Key Algorithms Waleed Ejaz
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.
Great Theoretical Ideas in Computer Science.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Midterm Review Cryptography & Network Security
Chapter 21 Public-Key Cryptography and Message Authentication.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
Cryptography 1 Crypto Cryptography 2 Crypto  Cryptology  The art and science of making and breaking “secret codes”  Cryptography  making “secret.
CRYPTOGRAPHY. WHAT IS PUBLIC-KEY ENCRYPTION? Encryption is the key to information security The main idea- by using only public information, a sender can.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
Introduction to Cryptography Lecture 9. Public – Key Cryptosystems Each participant has a public key and a private key. It should be infeasible to determine.
Cryptography issues – elliptic curves Presented by Tom Nykiel.
Great Theoretical Ideas in Computer Science.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2014.
1 The RSA Algorithm Rocky K. C. Chang February 23, 2007.
Key Exchange in Systems VPN usually has two phases –Handshake protocol: key exchange between parties sets symmetric keys –Traffic protocol: communication.
Lecture 5 Asymmetric Cryptography. Private-Key Cryptography Traditional private/secret/single key cryptography uses one key Shared by both sender and.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 14. Digital signature.
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.
Cryptography By: Nick Belhumeur. Overview What is Cryptography? What is Cryptography? 2 types of cryptosystems 2 types of cryptosystems Example of Encryption.
Overview Modern public-key cryptosystems: RSA
CS480 Cryptography and Information Security
Asymmetric-Key Cryptography
Practical Aspects of Modern Cryptography
Public Key Cryptosystem
Asymmetric-Key Cryptography
RSA Slides by Kent Seamons and Tim van der Horst
DTTF/NB479: Dszquphsbqiz Day 26
Public-Key Cryptography RSA Rivest-Shamir-Adelmann Public-Key System
Public Key Encryption Systems
PUBLIC-KEY ENCRYPTION Focusing on RSA
Public Key Encryption and Digital Signatures
Network Security.
RSA and El Gamal Cryptosystems
Public-key Cryptography
ICS 454 Principles of Cryptography
Topic 25: Discrete LOG, DDH + Attacks on Plain RSA
Foundations of Network and Computer Security
Public Key Cryptography Diffie-Hellman, Discrete Log, RSA
Analysis of the RSA Encryption Algorithm
Symmetric-Key Cryptography
Cryptography: Basics (2)
Public-Key Cryptography and Message Authentication
Intro to Cryptography Some slides have been taken from:
ICS 454 Principles of Cryptography
Key Management Network Systems Security
Network Security.
El Gamal and Diffie Hellman
Introduction to Elliptic Curve Cryptography
Where Complexity Finally Comes In Handy…
Chapter 3 - Public-Key Cryptography & Authentication
CSCE 715: Network Systems Security
Symmetric-Key Cryptography
PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9
Where Complexity Finally Comes In Handy…
刘振 上海交通大学 计算机科学与工程系 电信群楼3-509
Public Key Encryption Systems
Where Complexity Finally Comes In Handy…
Presentation transcript:

Asymmetric Encryption

Announcements Essay due Next homework – crypto (on paper) This week: more on encryption and authentication, then on to access control

Last time: symmetric key cryptography Based on shared knowledge of a private key BUT: protocol itself is not generally kept secret Very secure: For example, a 128-bit key in AES would take roughly 1 billion billion (est. 1.02 * 1018) years to crack on a 2012 supercomputer Simple and easy to implement – XORs, etc

Asymmetric key cryptography Also known as public key cryptography Alice publishes something openly Bob can then send messages to Alice using this public key Huge and recent development “New directions in cryptography”, by Diffie and Hellman, 1976 Daily conspiracy tidbit: Actually developed by UK government researchers in secret in 1973

Diffie-Hellman key exchange Based on Zp where p is either prime or a power of a prime (qk with q prime) We saw last time that Zp is a finite field: Nice + and * operations Has multiplicative inverses, as well: Take 2x = 1 mod 5 What is x?

The Diffie-Hellman protocol Consider p prime, and s < p (both public) Privately, Alice chooses a < p and Bob chooses b < p Alice computes A = sa mod p and posts it Bob computes B = sb mod p and posts it Alice computes the secret key Ba Bob computes the secret key Ab Claim: Ba = Ab, so they agree on a common secret key

Example: Let s = 2, p = 29 Alice likes a = 3 Bob likes b = 7

Why does this work? The common key is k = sab mod p Recap: public info is p, s, A = sa, and B = sb a, b, and k are all private What can an attacker do?

Hardness At its base, the key to why this is hard is something called the discrete logarithm problem. Remember logarithms? Log10 1000 = ? Log2 1024 = ? Here, we want discrete logs: given A, find logs A = logs sa = a, all modulo p

The discrete log problem This is a problem that we “think” is hard Similar to factoring Note that there ARE ways to attack this – it is not NP-Hard, but there are no known fast algorithms Stronger generalizations work in groups other than Zp, like something called elliptic curves A bit beyond this course, though

Beyond Diffie-Hellman Shortly after this protocol first came out, RSA was first released Stronger in many ways: it can be used to encrypt messages However, it usually isn’t! Slower than symmetric key encryption Easier to attack RSA is also built on hardness of factoring numbers (Note: I’m going over RSA the algorithm, not RSA the company – they are different)

RSA: General overview Alice looks up Bob’s public key, EB, in a directory Alice uses a known algorithm to encode a message m, resulting in EB(m) Bob then uses his private key DB to decode, so that DB(EB(m)) = m Idea: Alice can only give away m and EB(m), but no one else can decode without DB

How? Number theory! Definition: The Euler phi function φ(n) is defined as the number of integers less than n that are relatively prime to n Examples: φ(7) = ? φ(6) = ?

Phi function Lemma: If p is prime, then φ(p) = p-1 Lemma: If p and q are both prime, then φ(p*q) = φ(p)*φ(q) = (p-1)(q-1) Sketch of proof: What are p*q’s factors?

Euler’s Theorem Theorem: If a and n positive integers with a relatively prime to n (so that gcd(a,n) = 1), then aφ(n) = 1 mod n Example: Let n = 7 and a = 3: Another: Let n = 12 and a=5:

Euler’s Theorem Why should we care? Inverses! a and aφ(n)-1 will be inverses to each other modulo n So if a is relatively prime to n, then there exists some b such that ab = 1 mod n Just set b = aφ(n)-1 A corollary: xy mod n = xy mod φ(n) mod n

RSA (Rivest Shamir Adelmann) 1978 Bob generates two primes p and q Computes n = p*q and φ(n) = (p-1)(q-1) Bob then picks e relatively prime to φ(n) and finds a d such that e*d = 1 mod φ(n) He can do this, because he knows φ(n) – use Euclidean algorithm d is now DB, Bob’s private key (e,n) are his public key Essentially can forget about p,q, and φ(n)

RSA: encrypting Now go to Alice, who has a message m, as well as e and n To encrypt, Alice computes C = me mod n and sends C to Bob Bob then takes C and computes Cd mod n Claim: M = Cd mod n Why?

RSA: double check Well: Cd mod n = (Me)d mod n = Med mod n One way to see it: Euler’s Theorem corollary – can take exponent mod φ(n): xy mod n = xy mod φ(n) mod n So, here: Med mod n = Med mod φ(n) mod n = M1 mod n = M. Another way: know ed = 1 mod φ(n), so (by definition) have ed = 1 + kφ(n) for some value k Then Med = M1+kφ(n) mod n = M1 + Mkφ(n) mod n, and Mφ(n) = 1 mod n

RSA: double check Catch – need M relatively prime to n. Likely to be true, but we still want it to work Luckily, still works if not relatively prime! We know it is still relatively prime to either p or q, since both are prime. (Math is a bit more complex, but not hard to walk through the equations.)

The security of RSA Public knowledge: (e,n) How hard is it to get d? Recall: d is the value that is d’s inverse mod φ(n) This is easy if you know φ(n) Use the extended Euclidean algorithm How can you get φ(n) from (e,n)? Answer: factoring! Pretty good, though: no 512 bit number has yet been factored (I think…)

Cautions There are a lot of attacks on RSA Some examples: Don’t choose “bad” values of n: easier to factor sometimes, especially if n isn’t big enough Franklin-Reiter related message attack: If messages are related – for example, M1 = f(M2) for some polynomial f – then original messages can be recovered Many more, depending on implementation. In fact, “textbook” RSA, which we just went through, is considered insecure

Improvements: Elgamal The Elgamel cryptosystem (named after its inventor) adds randomness to the basic structure of RSA Result: encrypting the same message will give a different cipher text Alice will need a different random number each time, though, or won’t be more secure Nicely set up: encryptor (Alice) doesn’t need to know secret key, and decryptor (Bob) won’t need to know the random value Alice does need to send two things instead of one, but result is much more secure

Hashing Cryptographic hash functions are functions that take an input and return a fixed size alphanumeric string, call the hash value Also message digest, digital fingerprint, digest, and checksum Often used as signatures: provides reason to believe message has not been changed Also passwords, etc. Outside of security world also!

Goals of a hash Some things are unchanged from data structures! Goals of hash function: Easy to calculate Computationally difficult to calculate an input text that would generate any given hash output Extremely unlikely that two different message would give the same hash Essentially, these are deterministic functions that somehow behave randomly

Hashing standards NIST also had a call to standardize modern hashes, in 2007 Results: 3 different algorithms SHA (with a number at the end) SHA-256 employs a compression function with inputs of size 512 bits and outputs 256 bits SHA-512 takes 1024 and outputs 512 MD5 is sometimes also used, but is widely considered to be insecure Known attack where given two messages, one can compute two suffixes such that they collide Result: can compute (for example) different PDF files with the same hash

Takeaway message As a programmer or user of cryptography, you should know the major packages! NSA Suite B is modern standard: Encryption: AES Signatures: Elliptic curves Diffie-Hellman: variant of Diffie-Hellman that uses those elliptic curve groups I briefly mentioned last week Hashing: SHA

Note: no RSA! Yet RSA is the most widely used in the transport layer This is where website traffic lives, and we’ll talk more about it later in the course Why??

Why RSA? RSA is used in websites, smart cards, at the OS level, and in many other places Main reasons: speed, cost, legacy issues, etc.