Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © - 2004-2014 – Curt Hill Cryptography Number Theory’s Practical Application.

Similar presentations


Presentation on theme: "Copyright © - 2004-2014 – Curt Hill Cryptography Number Theory’s Practical Application."— Presentation transcript:

1 Copyright © - 2004-2014 – Curt Hill Cryptography Number Theory’s Practical Application

2 Introduction Encryption is mechanism for obscuring a message from someone else in a reversible way –Decryption is reversing it Cryptography is the study Historically used to send messages during wars –Non-standard hieroglyphics date back to at least 1900 BC Most of the historic ciphers are relatively easy to break Copyright © - 2004-2014 – Curt Hill

3 Terminology Plain text –A message that is readable –AKA Clear text Cipher text –A message that has been disguised Key –A string that allows the encryption and decryption Copyright © - 2004-2014 – Curt Hill

4 What we want Encryption technique E(M,K) which takes a message M and a key K Decryption technique D(M,K) which also takes message M and key K Both E and D return a string M = D(E(M,K),K) Neither E nor D needs to be concealed Only secret thing is K the key E and D are efficiently computable Copyright © - 2004-2014 – Curt Hill

5 Historical Ciphers Any technique that gives one side of a war an advantage over the other is of interest However most of these are not of interest to us in discrete math: Transposition and Substitution Cipher Enigma and Colosus One time pad Stream Cipher Block Cipher Feistel Cipher DES, AES Copyright © - 2004-2014 – Curt Hill

6 Transposition Cipher AKA Caesar cipher Number the letters Add a value, divide by 26 and keep remainder Key is the value Decryption subtracts the value There are very few keys so easy to crack rot13 is a variant Copyright © - 2004-2014 – Curt Hill

7 Transposition Example Plain ASCII BAT ASCII Numeric 666584 Transpose555 Cipher numeric 717089 Cipher as ASCII GFY Copyright © - 2004-2014 – Curt Hill

8 Substitution Cipher Generalization of transposition cipher Each letter is substituted by another letter or character For 26 characters there are 26! keys Usually succumbs to letter frequency attacks Copyright © - 2004-2014 – Curt Hill

9 Substitution Example Plain ASCIIBAT See table Cipher as ASCII UGM Copyright © - 2004-2014 – Curt Hill AG BU CA … TM …

10 Enigma Code machine used by Germans in World War II Several rotors A letter is typed in the rotors provide a single substitution cipher for that letter The rotors are now advanced The next letter gets a different transposition The key becomes the rotor settings The Colossus was used to break Copyright © - 2004-2014 – Curt Hill

11 Enigma Again Would have been secure if used properly Instead they often used same key for too long Predictable openings were often used: –Common greetings: Mein Fueherer! –This gives away the key to analysis Users thought it was magic so did not worry enough Copyright © - 2004-2014 – Curt Hill

12 One time pad The one time pad is a string of offsets to add to each letter of message Two copies of the pad: the sender and receiver Pad is never reused Algorithmically unbreakable if there is no pattern in the pad Transfer of the pad may be a problem Copyright © - 2004-2014 – Curt Hill

13 OTP Example Plain ASCII BAT ASCII Numeric 666584 One time pad 12923 Cipher numeric 7874107 Cipher as ASCII NJk Copyright © - 2004-2014 – Curt Hill

14 Stream cipher An almost One Time Pad Start with a key Generate a pseudorandom sequence derived from the key To decrypt they have to know the key and the function that generates the pseudorandom sequence Copyright © - 2004-2014 – Curt Hill

15 Block Ciphers The plain text is subdivided into to N bit blocks Each block is then transformed The mode of operation determines how the Nth block encryption is different than the previous Example: –128 bit key and block –Operation is XOR (easily reversible) –Result of N is key of N+1 Copyright © - 2004-2014 – Curt Hill

16 Feistel Cipher Named after Horst Feistel at IBM It is a block cipher with a symmetric structure The encryption and decryption are very similar or identical The block is split in half and multiple rounds of transformation occur Copyright © - 2004-2014 – Curt Hill

17 Feistel Transformations The typical transformations are quite simple and reversible XORs Bit shuffling –Bit 1 becomes bit 3, bit 2 becomes bit 5 etc. Simple non-linear functions Copyright © - 2004-2014 – Curt Hill

18 Process Partition the key into N+1 pieces F is a round function takes one of the keys The text is split into two equal pieces –L 0, R 0 For i=0 to N –L i+1 = R i –R i+1 = L i  F(R i, K i ) Decryption is the reverse For i=n downto 0 –R i = L i+1 –L i = R i+1  F(L i+1, K i ) Copyright © - 2004-2014 – Curt Hill

19 Data Encryption Standard A form of Feistel Cipher Key size is 56 bits Use 16 rounds This is breakable but difficult to do so In the 1990s Field Programmable gate arrays could be constructed for about $50,000 40 bit DES takes about 1 second 56 bit about 20 hour Copyright © - 2004-2014 – Curt Hill

20 AES Advanced Encryption System 128 bit block Key sizes 128, 192 or 256 bits 10, 12 or 14 rounds Not a Feistel anymore Copyright © - 2004-2014 – Curt Hill

21 Other related schemes Blowfish – 448 bit key CAST-128 –PGP 5 with 128 bit key IDEA –Patented and became PGP Copyright © - 2004-2014 – Curt Hill

22 Distribution The problem with most ciphers is called the key distribution problem How is the key given to the receiver by the sender? Since everything else is known this becomes a weak link Public Key Encryption does not suffer from this problem Copyright © - 2004-2014 – Curt Hill

23 Public key encryption AKA Trapdoor algorithms Each user has a public and private key These are usually very large numbers, based on primes The key is that multiplying/dividing very large numbers is easy Factoring a very large number into its primes is very difficult –Conceivably taking years Copyright © - 2004-2014 – Curt Hill

24 Authors This algorithm was devised by Ron Rivest, Adi Shamir and Leonard Adleman RSA became the name of the algorithm MIT patented Published in 1977 Proofs of its effectiveness abound They received Turing award Copyright © - 2004-2014 – Curt Hill

25 Key Generation Find two large primes, P and Q –Approximately equal in size Compute the product N = PQ –N should be 1024 bits or larger –Known as the modulus Compute  = (P-1)(Q-1) –  is spelled phi and pronounced fee Copyright © - 2004-2014 – Curt Hill

26 Two more Choose E such that 1 < E <  –E and  must be relatively prime –Neither needs to be prime but relatively prime to each other –This is the public exponent or encryption exponent Find D –1 < D <  –ED mod  = 1 –This is the secret exponent or decryption exponent Copyright © - 2004-2014 – Curt Hill

27 How it works The public key is a pair (E,N) and the private key is also a pair (D,N) Everyone participating in concealed messages publishes their public key where anyone can access The private key as well as P, Q and N are also kept secret Copyright © - 2004-2014 – Curt Hill

28 Sending a message Albert wants to send Bob a secret message Obtains Bobs public key (E,N) Convert the clear text into numeric chunks of the suitable length, call one of these M Compute cipher text: C = M E mod N Repeat for subsequent chunks and send Copyright © - 2004-2014 – Curt Hill

29 Reading sent message Bob now wants to read Albert’s message Use his own private key to restore the plain text –M = C D mod N Copyright © - 2004-2014 – Curt Hill

30 Another Thought Anyone may send a message to anyone else How do we determine if someone has falsified a message? The digital signing process is not that much different than the encryption and decryption Copyright © - 2004-2014 – Curt Hill

31 Digital Signing Albert extracts pieces of the message to make a digest Albert uses his private key to compute S = M D mod N Bob uses Albert’s public key to compute V = S E mod N Bob uses the same extraction method and compares this with the sent signature Copyright © - 2004-2014 – Curt Hill

32 Some practicalities Common choices for E are 3, 17 and 65537 which are Fermat primes –This makes the modular exponentiation quick Computing D often uses the Extended Euclidean Algorithm Copyright © - 2004-2014 – Curt Hill

33 Is it breakable? The usual thought is that factoring very large numbers is extremely difficult The current unclassified belief is that factoring these size numbers would take centuries or longer –Of course, rumors abound The open question is if there is a technique that can crack this that does not require factorization Copyright © - 2004-2014 – Curt Hill

34 Steganography Concealing something in something else Common practice is to conceal a message in something else The advantage over cryptography is that the item passed is not otherwise suspicious Not very helpful for database security Mainly used by spies and terrorists Copyright © - 2004-2014 – Curt Hill

35 Techniques Invisible ink Message under the postage stamp Text where every Nth letter makes up the message Modification of a few pixels in a large image Using the least significant bits of sound recordings Hidden frames in video Copyright © - 2004-2014 – Curt Hill

36 Summary Encryption maintains the data but make it unusable to those without the key Use decryption to return to plain text Used for transmitting sensitive data and for stored data on disk With this background we may now consider database security Copyright © - 2004-2014 – Curt Hill


Download ppt "Copyright © - 2004-2014 – Curt Hill Cryptography Number Theory’s Practical Application."

Similar presentations


Ads by Google