public key cryptography

Upload: imran

Post on 12-Oct-2015

19 views

Category:

Documents


0 download

DESCRIPTION

Encryption & Decryption

TRANSCRIPT

  • Starter Activity*

  • *

    Public Key Cryptography & RSA Algorithm

  • Aim & ObjectivesPrivate-key Cryptography

    Public-Key Cryptography

    RSA Algorithm

    RSA with example work

    Activity

    *

  • Private-Key Cryptography*

  • *Public key CryptographyAlso known as asymmetric cryptographyA pair of keys (Public, Private)(Can think of this as one long key in two parts)One used for encryption, the other for decryptionOne publicly accessible, the other private to one personAlgorithms / SystemsRSA (Rivest, Shamir, Adelman)DSA (Digital Signature Algorithm)PGP, OpenPGP, GPG (Gnus PGP)ssh, sftpSSL

  • *Public Key Cryptography

  • *Public Key CryptographyKey is some large number (string of bits)Key has two parts, one public, one privatePublic key is well-knownTrusted agents verify the public keyPrivate key is a secret foreverKey is arbitrarily largeEncrypt with receivers public keyDecrypt with receivers private key

  • *RSA AlgorithmRivest, Shamir & Adleman of MIT in 1977 best known & widely used public-key schemeRSA Key SetupChoose two large primes, p and qCompute n = (p)(q)Compute z = (p-1)(q-1)Choose d such that it is relatively prime to z (no common divisor)Find e such that (e)(d) modulo z = 1Public key is (e,n)Private key is (d,n)

  • *RSA AlgorithmTo encrypt plaintext message m, compute c = me mod nTo decrypt ciphertext message c, compute m = cd mod n

  • *Work an Example1. Choose two (not so large) primes, p and q p = 47 and q = 712. n = (p)(q) = (47)(71) = 3337 = n3. z = (p-1)(q-1) = (46)(70) = 3220 = z4. Choose e (or d) such that it is relatively prime to z (i.e., e and z share no common divisors)e=5? 3220/5=644 noe=23? 3220/23=140 noe=35? 3220/35=92 noe=79? 3220 and 79 share no divisors ... yes

  • *Work an Example5. Choose d such that (e)(d) modulo z = 1So: 79d mod z = 1 now what?6. Public key = (e, n) = (79, 3337) 7. Private key = (d, n) = (1019, 3337) Compute candidate values of dd = 1019 or 4239 or 7459 or ...

  • *Work an Example9. Decrypt: m = cd mod nm = 21401019 mod 3337m = 38. Encrypt: c = me mod nc = 379 mod 3337c = 2140

  • *

  • *RSA AlgorithmNow imagine that p and q are hundreds of digits long!Power of PKC based upon the difficulty of factoring large numbersCommercial firms provide:choice of p and qsuitable e and dsoftware for large integer arithmeticregistration of keys to a particular entity

  • *RSA ImplementationJava implementation of the RSA version of public key cryptographyhttp://intercom.virginia.edu/crypto/crypto.html

  • Activity*