30
Cryptography Cryptography

Crypt

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Crypt

CryptographyCryptography

Page 2: Crypt

OUTLINEOUTLINE

IntroductionIntroduction Brief HistoryBrief History General ModelGeneral Model Security Issues in CryptographySecurity Issues in Cryptography Cryptographic techniquesCryptographic techniques Advantages And DisadvantagesAdvantages And Disadvantages ApplicationsApplications ConclusionConclusion

Page 3: Crypt

IntroductionIntroduction Cryptography -- from the Greek Cryptography -- from the Greek

word for “secret writing” -- is the word for “secret writing” -- is the “scrambling” of data so that only “scrambling” of data so that only someone with the necessary someone with the necessary keykey can “unscramble” it. can “unscramble” it.

Provide Provide secrecy. . Authenticate that a message has that a message has

not changed in transit. not changed in transit. Implicitly authenticate the sender. Implicitly authenticate the sender.

Page 4: Crypt

Brief HistoryBrief History

The first documented use of The first documented use of cryptography in writing dates back cryptography in writing dates back 1900 B.C. 1900 B.C.

When an Egyptian scribe used non-When an Egyptian scribe used non-standard code in an inscription. standard code in an inscription.

Page 5: Crypt

General modelGeneral model

Basic communication scenarioBasic communication scenario

Encrypt Decrypt Alice Bob

Eve

Encryption Key Decryption Key

plaintext ciphertext

Enemy orAdversary

Page 6: Crypt

Security IssuesSecurity Issues

ConfidentialityConfidentiality: can a 3rd party see : can a 3rd party see it?it?

AuthenticationAuthentication: Who am I talking to?: Who am I talking to? Non-repudiationNon-repudiation: can you claim you : can you claim you

didn’t send it even if you really did?didn’t send it even if you really did? IntegrityIntegrity: was it altered before I got : was it altered before I got

it?it?

Page 7: Crypt

Confidentiality Authentication

A B

C C

A BI amUser A

Integrity

A B

C

Ideal route of message

Actual route of message

Page 8: Crypt

Cryptographic techniquesCryptographic techniques

Encryption Encryption DecryptionDecryption Symmetric key (Secret Key)Symmetric key (Secret Key) Asymmetric key (Public Key)Asymmetric key (Public Key)

Page 9: Crypt

Encryption And DecryptionEncryption And Decryption

EncryptionEncryption: The process of encoding plain text : The process of encoding plain text messages into cipher text messages is called messages into cipher text messages is called encryption.encryption.

DecryptionDecryption: The reverse process of : The reverse process of transforming cipher text messages back to transforming cipher text messages back to plain text messages is called as decryption.plain text messages is called as decryption.

Encryption Encryption

Plain text Encrypt cipher text

cipher text Decrypt Plain text

Hello John Ifmmp Kpio Hello JohnIfmmp Kpio

DecryptionDecryption

Page 10: Crypt

Rules for Encryption/DecryptionRules for Encryption/Decryption

Every encryption and decryption Every encryption and decryption process has two rules or aspects:process has two rules or aspects:

Algorithm and KeyAlgorithm and Key Algorithm: Used for encryption and Algorithm: Used for encryption and

decryption processes is usually known decryption processes is usually known to everybody.to everybody.

Key: Used for encryption and Key: Used for encryption and decryption that makes the process of decryption that makes the process of cryptography secure.cryptography secure.

Page 11: Crypt

Types of Encryption AlgorithmsTypes of Encryption Algorithms Substitution ciphersSubstitution ciphers Transposition ciphersTransposition ciphers

Substitution Ciphers:Substitution Ciphers: Every letter (or group of letters) is replaced by Every letter (or group of letters) is replaced by

another letter (or group of letters)another letter (or group of letters) Example:Example:

Caesar cipher:Caesar cipher: a/D, b/E, c/F, d/G, …, z/Ca/D, b/E, c/F, d/G, …, z/C

Monoalphabetic cipher:Monoalphabetic cipher: a/Q, b/W, c/E, …a/Q, b/W, c/E, …

Easy to break by analyzing statistical Easy to break by analyzing statistical properties of written languageproperties of written language

Page 12: Crypt

Transposition Ciphers:Transposition Ciphers: Instead of substituting letters in the Instead of substituting letters in the

plaintext, we change their orderplaintext, we change their order

A N D R E W1 4 2 5 3 6t h i s i sa m e s s ag e i w o ul d l i k et o e n c ry p t n o w

Key = ANDREWPlaintext = thisisamessageiwould liketoencryptnowCiphertext = tagltyieiletisokco hmedopsswinnsauerw

Page 13: Crypt

Symmetric Cryptography (Secret Key)Symmetric Cryptography (Secret Key)

Page 14: Crypt

Advantages of Classical Advantages of Classical CryptographyCryptography

There are some very fast classical There are some very fast classical encryption (and decryption) algorithmsencryption (and decryption) algorithms

Since the speed of a method varies with Since the speed of a method varies with the length of the key, faster algorithms the length of the key, faster algorithms allow one to use longer key values.allow one to use longer key values.

Larger key values make it harder to Larger key values make it harder to guess the key valueguess the key value -- and break the -- and break the code -- by brute force.code -- by brute force.

Page 15: Crypt

Disadvantages of Classical Disadvantages of Classical CryptographyCryptography

Requires secure transmission of Requires secure transmission of key valuekey value

Requires a separate key for each group Requires a separate key for each group of people that wishes to exchange of people that wishes to exchange encrypted messages (readable by any encrypted messages (readable by any group member)group member) For example, to have a separate key for For example, to have a separate key for

each pair of people, 100 people would need each pair of people, 100 people would need 4950 different keys.4950 different keys.

Page 16: Crypt

Public-Key Cryptography: Public-Key Cryptography: Asymmetric CryptographyAsymmetric Cryptography

Alice generates a key value (usually Alice generates a key value (usually a number or pair of related a number or pair of related numbers) which she makes public. numbers) which she makes public.

Alice uses her public key (and some Alice uses her public key (and some additional information) to determine additional information) to determine a second key (her a second key (her private keyprivate key).).

Alice keeps her private key (and the Alice keeps her private key (and the additional information she used to additional information she used to construct it) secret.construct it) secret.

Page 17: Crypt

Public-Key Cryptography Public-Key Cryptography (continued)(continued)

Bob (or Carol, or anyone else) can use Bob (or Carol, or anyone else) can use Alice’s public key to encrypt a message Alice’s public key to encrypt a message for Alice.for Alice.

Alice can use her private key to decrypt Alice can use her private key to decrypt this message.this message.

No-one without access to Alice’s private No-one without access to Alice’s private key (or the information used to construct key (or the information used to construct it) can easily decrypt the message.it) can easily decrypt the message.

Page 18: Crypt

An Example: Internet An Example: Internet CommerceCommerce

Bob wants to use his credit card to Bob wants to use his credit card to buy some brownies from Alice over buy some brownies from Alice over the Internet.the Internet.

Alice sends her public key to Bob.Alice sends her public key to Bob. Bob uses this key to encrypt his Bob uses this key to encrypt his

credit-card number and sends the credit-card number and sends the encrypted number to Alice.encrypted number to Alice.

Alice uses her private key to decrypt Alice uses her private key to decrypt this message (and get Bob’s credit-this message (and get Bob’s credit-card number).card number).

Page 19: Crypt

Hybrid Encryption SystemsHybrid Encryption Systems

All known public key encryption All known public key encryption algorithms are much slower than the algorithms are much slower than the fastest secret-key algorithms.fastest secret-key algorithms.

In a In a hybrid hybrid system, Alice uses Bob’s system, Alice uses Bob’s public key to send him a secret public key to send him a secret shared shared session keysession key..

Alice and Bob use the session key to Alice and Bob use the session key to exchange information.exchange information.

Page 20: Crypt

Internet Commerce Internet Commerce (continued)(continued) Bob wants to order brownies from Alice Bob wants to order brownies from Alice

and keep the and keep the entire transactionentire transaction private. private. Bob sends Alice his public key.Bob sends Alice his public key. Alice generates a session key, encrypts it Alice generates a session key, encrypts it

using Bob’s public key, and sends it to using Bob’s public key, and sends it to Bob.Bob.

Bob uses the session key (and an agreed-Bob uses the session key (and an agreed-upon symmetric encryption algorithm) to upon symmetric encryption algorithm) to encrypt his order, and sends it to Alice.encrypt his order, and sends it to Alice.

Page 21: Crypt

Digital Signatures:Digital Signatures:Signing a DocumentSigning a Document

Alice applies a (publicly known) Alice applies a (publicly known) hash hash functionfunction to a document that she wishes to a document that she wishes to “sign.” This function produces a to “sign.” This function produces a digestdigest of the document (usually a of the document (usually a number).number).

Alice then uses her Alice then uses her privateprivate key to key to “encrypt” the digest.“encrypt” the digest.

She can then send, or even broadcast, She can then send, or even broadcast, the document with the encrypted digest. the document with the encrypted digest.

Page 22: Crypt

Digital Signature Digital Signature Verification Verification

Bob uses Alice’s Bob uses Alice’s publicpublic key to key to “decrypt” the digest that Alice “decrypt” the digest that Alice “encrypted” with her private key.“encrypted” with her private key.

Bob applies the hash function to the Bob applies the hash function to the document to obtain the digest document to obtain the digest directly.directly.

Bob compares these two values for Bob compares these two values for the digest. If they match, it proves the digest. If they match, it proves that Alice signed the document and that Alice signed the document and that no one else has altered it.that no one else has altered it.

Page 23: Crypt

Secure Transmission of Secure Transmission of Digitally Signed DocumentsDigitally Signed Documents

Alice uses her Alice uses her private private key to digitally sign key to digitally sign a document. She then uses Bob’s a document. She then uses Bob’s publicpublic key to encrypt this digitally signed key to encrypt this digitally signed document.document.

Bob uses his Bob uses his privateprivate key to decrypt the key to decrypt the document. The result is Alice’s digitally document. The result is Alice’s digitally signed document.signed document.

Bob uses Alice’s Bob uses Alice’s publicpublic key to verify Alice’s key to verify Alice’s digital signature.digital signature.

Page 24: Crypt

Historical BackgroundHistorical Background

1976: W. Diffie and M.E. Hellman proposed 1976: W. Diffie and M.E. Hellman proposed the first public-key encryption algorithms the first public-key encryption algorithms -- actually an algorithm for public -- actually an algorithm for public exchangeexchange of a secret key. of a secret key.

1978: L.M Adleman, R.L. Rivest and A. 1978: L.M Adleman, R.L. Rivest and A. Shamir propose the RSA encryption Shamir propose the RSA encryption methodmethod Currently the most widely usedCurrently the most widely used Basis for the spreadsheet used in the labBasis for the spreadsheet used in the lab

Page 25: Crypt

The RSA Encryption The RSA Encryption AlgorithmAlgorithm

Use a random process to select two Use a random process to select two large prime numbers large prime numbers PP and and QQ. . Compute the product Compute the product M = P*QM = P*Q. . This number is called the This number is called the modulusmodulus, , and is made publicly available.and is made publicly available. RSA currently recommends a modulus RSA currently recommends a modulus

that’s at least 768 bits long. that’s at least 768 bits long. Also compute the Also compute the Euler totientEuler totient

T = (P-1)*(Q-1)T = (P-1)*(Q-1). Keep this number . Keep this number (as well as (as well as PP and and QQ) secret. ) secret.

Page 26: Crypt

RSA (continued)RSA (continued)

Randomly choose a public key Randomly choose a public key EE that has no that has no factors in common with factors in common with T = (P-1)*(Q-1)T = (P-1)*(Q-1)..

Compute a private key Compute a private key DD so that so that E*DE*D leaves leaves a remainder of 1 when divided by a remainder of 1 when divided by TT.. We say We say E*D E*D is is congruentcongruent to to 11 modulomodulo TT

Note that Note that DD is easy to compute only if one is easy to compute only if one knows the value of T. This is essentially the knows the value of T. This is essentially the same as knowing the values of P and Q.same as knowing the values of P and Q.

Page 27: Crypt

RSA (continued)RSA (continued) If If NN is any number that is not divisible by is any number that is not divisible by

MM, then dividing , then dividing NNE*DE*D by by MM and taking the and taking the remainder yields the original value remainder yields the original value NN. . This is a relatively deep mathematical This is a relatively deep mathematical

theorem, which we can write as theorem, which we can write as NNE*DE*D mod M mod M = N= N.).)

If If NN is a numeric encoding of a block of is a numeric encoding of a block of plaintext, the cyphertext plaintext, the cyphertext is C = Nis C = NE E mod mod M.M.

Then Then CCD D mod M = mod M = ((NNEE))DD mod M = mod M = NNE*DE*D mod M = N mod M = N. Thus, we can recover . Thus, we can recover the plaintext the plaintext NN with the private key with the private key DD..

Page 28: Crypt

Why RSA WorksWhy RSA Works Multiplying P by Q is Multiplying P by Q is easyeasy: the : the

number of operations depends on number of operations depends on the the number of bitsnumber of bits (number of (number of digits) in P and Q.digits) in P and Q.

For example, multiplying two 384-For example, multiplying two 384-bit numbers takes approximately bit numbers takes approximately 3843842 =2 = 147,456 bit operations 147,456 bit operations

Page 29: Crypt

Why RSA Works (2)Why RSA Works (2) If one knows only M, finding P and Q is If one knows only M, finding P and Q is

hardhard: in essence, the number of : in essence, the number of operations depends on the operations depends on the value value of M.of M. The simplest method for factoring a 768-bit The simplest method for factoring a 768-bit

number takes about 2number takes about 2384 384 3.94 3.94 1010115115 trial trial divisions.divisions.

A more sophisticated methods takes about A more sophisticated methods takes about 2285 85 3.87 3.87 10 102525 trial divisions. trial divisions.

A still more sophisticated method takes A still more sophisticated method takes about 2about 241 41 219,000,000,000 trial divisions 219,000,000,000 trial divisions

Page 30: Crypt

Why RSA Works (3)Why RSA Works (3)

No-one has found an really quick algorithm No-one has found an really quick algorithm for factoring a large number for factoring a large number MM..

No-one has proven that such a quick No-one has proven that such a quick algorithm doesn’t exist (or even that one is algorithm doesn’t exist (or even that one is unlikely to exist).unlikely to exist).

Peter Shor has devised a very fast factoring Peter Shor has devised a very fast factoring algorithm for a algorithm for a quantum computerquantum computer, if , if anyone manages to build one.anyone manages to build one.