Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cryptography for Programmers

Cryptography for Programmers

Chattanooga Developer Lunch 2/27/14

Micah Hausler

February 27, 2014
Tweet

More Decks by Micah Hausler

Other Decks in Programming

Transcript

  1. Cryptography for Programmers by Micah Hausler -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJTD2UAAAoJEAqqvvuLCfqLBhAIAMLNrUlo5wYLv4142ra1Jrpy

    TZfQJ5mULkoywnEWEIP5DGoWgCnvQ7XAhwhnctjHMUeoh8xZrpl6FEbTYMHqBzyz znuCT5FJ1npJch5euFUsgocCNWnmekD8uIj5fFpApnIMH7tPHLHPSTCRYTt062bh 1Tmvu9Xh/JeO+dCdnoMvqRf+aIkIWDURircoktuu3LkQHReEDaU9CQir8fcdenSX IiL92zEIpPTscU0YdnE9j6MxlmwVNVBz14Y9lHhwQ3KpQ2liv2jyl6e8FgWFeO3b DMweMfTF6Hvv7NoJFZiyvmaj46htJqrVQKh8PwElp+8LhQCbtM67WuLuBCDhJ50= =0pfu -----END PGP SIGNATURE-----
  2. One to One My super secret message to Adam. My

    super secret message to Adam. Pb vxshu vhfuhw phvvdjh wr Dgdp. symmetric key symmetric key
  3. Private Key -----BEGIN PGP PRIVATE KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.22

    (Darwin) Comment: GPGTools - https://gpgtools.org ! lQH+BFMPXIMBBADTwlZb56AJc8rRBBKEO8MS89Uxir0aMvDSRWbZDDJdxi+ju4ms 3zR4BQtAS9sKdDJwqTBE7aMEMBFkYBAar24PyTBBsMtqss22Xjf0FjNyc/RPOUJF gThSpDTQuxy7nVfviCo6iPdzus+9oPmDzwsRGjy94zazp0y2yEAYlwQTkwARAQAB /gMDAk9pMXvdJE6Yzg4ckKf7Hy98UAw9HnLaM5Dd801DsGGud9aVRkepObaeQT0w 2iI1jEOXMqUPxznyeBWYatI2my1GAkfOsC9wY5MiLu7vA96fW1Qi+9biAWOgvwh/ krn4tn/O4DfZQpgPqEMN1ET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OlBzj7raA83iTvAsBrO0Do4iM/ytzL0OR0L8/Um/tN53vSTpGZfS5S0W HKIxN8nuNBXLfRdlus/9Cd+J8JoM/Vt6qtRjff9L9uDwtSYffIqPqPgA3txZgjhf ewPEL5FF94qCqd3KQKUrfNi1xVg14HJOMCGaTk8pPuhvBTnY5jGvpGO/Xj2z9/KI oD/fA0BfvYTqeWy9zEN8gGuNWB2GL7cVuGJXpjV+AY6Ags4cfcsBGr9Ey83mZqQM EoifBBgBCgAJBQJTD1yDAhsMAAoJEGXGeVieQZdKLgIEAI5CxJNOCtsMgwiFPn+I jnSQZY4smTYGfE+ZsdZ7uKrWg+qcHE4yvcf6C9+DXAPX5yEgytKuZrGZ+tth0PtN OVHD7ZrHXQ/NZ4PgOHnrWYykxwUwRWERstDHvdGzRM59kw73hhh5nLH0leMEYJMT XzoVJfCuqW1Erq2+5zvwsxgu =BUOt -----END PGP PRIVATE KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org ! mI0EUw9cgwEEANPCVlvnoAlzytEEEoQ7wxLz1TGKvRoy8NJFZtkMMl3GL6O7iazf NHgFC0BL2wp0MnCpMETtowQwEWRgEBqvbg/JMEGwy2qyzbZeN/QWM3Jz9E85QkWB OFKkNNC7HLudV++IKjqI93O6z72g+YPPCxEaPL3jNrOnTLbIQBiXBBOTABEBAAG0 JUx1bmNodGFsayA8bHVuY2h0YWxrQHRyeWFtYml0aW9uLmNvbT6ItwQTAQoAIQUC Uw9cgwIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRBlxnlYnkGXSqPyA/45 QYpF/EqP4tl8QNoS4UaIaUHosgQJ3xH+w2PGhKjgAFNuy2QZV1MOs+C5gY93/fAI yytozUOWyzqRBAce3rynRJe7Q1FsblbzsnQpnYqtXuWxULZ/fxoZHUsJvM8WSbUL Ky+NN01qHvDrOW6mDQLgYLIPwTRxIFeMTkodqvAyiriNBFMPXIMBBADbBjrz82Jw hCOa5SyCq3jg1g6tUdKZoszVWHx/kDG3uRAbNve21H+QGt8dedSUp58tLb1q+oje UuRHdESJBOk5x5f57Z8mn3+arAHjCxUj3TvWFc2SDTU8u19Ro00Z7UH0u3Ik5Xik wgG+a4ysI7DygvYfpNG/GOWXcsipmycB4QARAQABiJ8EGAEKAAkFAlMPXIMCGwwA CgkQZcZ5WJ5Bl0ouAgQAjkLEk04K2wyDCIU+f4iOdJBljiyZNgZ8T5mx1nu4qtaD 6pwcTjK9x/oL34NcA9fnISDK0q5msZn622HQ+005UcPtmsddD81ng+A4eetZjKTH BTBFYRGy0Me90bNEzn2TDveGGHmcsfSV4wRgkxNfOhUl8K6pbUSurb7nO/CzGC4= =h1AD -----END PGP PUBLIC KEY BLOCK----- Public Key
  4. Hey Micah, It Adam Haney. We’re changing our company name.

    Don’t tell anyone. Thanks, Adam -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org ! mI0EUw9cgwEEANPCVlvnoAlzytEEEoQ7wxLz1TGKvRoy8NJFZtkMMl3GL6O7iazf NHgFC0BL2wp0MnCpMETtowQwEWRgEBqvbg/JMEGwy2qyzbZeN/QWM3Jz9E85QkWB OFKkNNC7HLudV++IKjqI93O6z72g+YPPCxEaPL3jNrOnTLbIQBiXBBOTABEBAAG0 JUx1bmNodGFsayA8bHVuY2h0YWxrQHRyeWFtYml0aW9uLmNvbT6ItwQTAQoAIQUC Uw9cgwIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRBlxnlYnkGXSqPyA/45 QYpF/EqP4tl8QNoS4UaIaUHosgQJ3xH+w2PGhKjgAFNuy2QZV1MOs+C5gY93/fAI yytozUOWyzqRBAce3rynRJe7Q1FsblbzsnQpnYqtXuWxULZ/fxoZHUsJvM8WSbUL Ky+NN01qHvDrOW6mDQLgYLIPwTRxIFeMTkodqvAyiriNBFMPXIMBBADbBjrz82Jw hCOa5SyCq3jg1g6tUdKZoszVWHx/kDG3uRAbNve21H+QGt8dedSUp58tLb1q+oje UuRHdESJBOk5x5f57Z8mn3+arAHjCxUj3TvWFc2SDTU8u19Ro00Z7UH0u3Ik5Xik wgG+a4ysI7DygvYfpNG/GOWXcsipmycB4QARAQABiJ8EGAEKAAkFAlMPXIMCGwwA CgkQZcZ5WJ5Bl0ouAgQAjkLEk04K2wyDCIU+f4iOdJBljiyZNgZ8T5mx1nu4qtaD 6pwcTjK9x/oL34NcA9fnISDK0q5msZn622HQ+005UcPtmsddD81ng+A4eetZjKTH BTBFYRGy0Me90bNEzn2TDveGGHmcsfSV4wRgkxNfOhUl8K6pbUSurb7nO/CzGC4= =h1AD -----END PGP PUBLIC KEY BLOCK----- ()My Public Key message: = -----BEGIN PGP MESSAGE----- Comment: GPGTools - https://gpgtools.org ! hIwDrc0SmI9gm6cBA/48CFd4qfUY4RmTKdmSD3R8pcefWGkiRPsNmSrAhX8tZBxQ EwlbMZMEMBfwEvxkg8lANe+Rvf8oZefe9+8cbdURYlh/Bmw0UehJcPAa9moPym7O p9g4+b87dsUX3b658a8ETWSLZE/fBnnEOipBH8Ka4qww0DKRuneNlzEsr6c6etKW AYey1T/Axlj94pSQpcvZ9mh+LGeKNyhUeOIyo/1V8S7IgQ78sd9oUTSg+HR3B0kB YpSQAluSN2C82dSvxgc2tRwQYdgMf1av6oFQVhjWPd9s2CbIZi8Y5sse99awSddY C+HBb2w5Bg8fJHuiKgOcxUusuayW1D/zqdvCFV0tV3EfssZPeDeN6gFNuB8xdciR UF65CeOj =VXJ7 -----END PGP MESSAGE----- Encryption!
  5. Hey Adam, It’s cool. I won’t tell anyone. Thanks, Micah

    -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - https://gpgtools.org ! mI0EUw9cgwEEANPCVlvnoAlzytEEEoQ7wxLz1TGKvRoy8NJFZtkMMl3GL6O7iazf NHgFC0BL2wp0MnCpMETtowQwEWRgEBqvbg/JMEGwy2qyzbZeN/QWM3Jz9E85QkWB OFKkNNC7HLudV++IKjqI93O6z72g+YPPCxEaPL3jNrOnTLbIQBiXBBOTABEBAAG0 JUx1bmNodGFsayA8bHVuY2h0YWxrQHRyeWFtYml0aW9uLmNvbT6ItwQTAQoAIQUC Uw9cgwIbAwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRBlxnlYnkGXSqPyA/45 QYpF/EqP4tl8QNoS4UaIaUHosgQJ3xH+w2PGhKjgAFNuy2QZV1MOs+C5gY93/fAI yytozUOWyzqRBAce3rynRJe7Q1FsblbzsnQpnYqtXuWxULZ/fxoZHUsJvM8WSbUL Ky+NN01qHvDrOW6mDQLgYLIPwTRxIFeMTkodqvAyiriNBFMPXIMBBADbBjrz82Jw hCOa5SyCq3jg1g6tUdKZoszVWHx/kDG3uRAbNve21H+QGt8dedSUp58tLb1q+oje UuRHdESJBOk5x5f57Z8mn3+arAHjCxUj3TvWFc2SDTU8u19Ro00Z7UH0u3Ik5Xik wgG+a4ysI7DygvYfpNG/GOWXcsipmycB4QARAQABiJ8EGAEKAAkFAlMPXIMCGwwA CgkQZcZ5WJ5Bl0ouAgQAjkLEk04K2wyDCIU+f4iOdJBljiyZNgZ8T5mx1nu4qtaD 6pwcTjK9x/oL34NcA9fnISDK0q5msZn622HQ+005UcPtmsddD81ng+A4eetZjKTH BTBFYRGy0Me90bNEzn2TDveGGHmcsfSV4wRgkxNfOhUl8K6pbUSurb7nO/CzGC4= =h1AD -----END PGP PUBLIC KEY BLOCK----- ()My Private Key message: = -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ! Hey Adam, It’s cool. I won’t tell anyone. Thanks, Micah -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org ! iJwEAQEKAAYFAlMPY/8ACgkQZcZ5WJ5Bl0pyLAP/c+6YQOclUadeyNTxQJCGxaxm KzZ+WVLCBpA6e36pBkfEKRImd55HlRLw8d0yasTwuX8dy5qv+o9nwfzUB7z5lR5R YJfAk4SkUr/oGhXE2cr1iIhMMzzZ+6yi8Wb7Of3OMIdiu4viJe4A8CzGCHop2jEV uL2lIZHyN8Xmb36T5As= =nEf1 -----END PGP SIGNATURE----- Signature!
  6. RSA

  7. P and Q prime numbers N = PQ ø(n) =

    1 mod (P-1)(Q-1) select e such that gcd(ø(n), e) =1 calculate d where d•e = 1 mod ø(n) ! Public Key (kU) = {e,n} Private Key (kP) = {d,n}