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

Just Enough Math to Understand Elliptic Curve Cryptography

Just Enough Math to Understand Elliptic Curve Cryptography

Elliptic Curve Cryptography is used in many real world protocols like TLS, SSH, IPsec, Whatsapp, Bitcoin and many more.

Trying to build an understanding of how it works, however, can be fairly daunting for anyone who doesn't have a deep mathematics background. This talk walks through just enough math needed to understand how the most common Elliptic Curve Cryptography primitives work.

Mrinal Wadhwa

March 04, 2020
Tweet

More Decks by Mrinal Wadhwa

Other Decks in Programming

Transcript

  1. Banking, Commerce, Communication … The systems, we build, rely on

    various cryptographic protocols to ensure integrity and confidentiality of data that flows within them. Systems
  2. Banking, Commerce, Communication … PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin

    … The systems, we build, rely on various cryptographic protocols to ensure integrity and confidentiality of data that flows within them. Systems Protocols
  3. Banking, Commerce, Communication … These protocols are, in turn, constructed

    by combining well defined cryptographic primitives - key agreement, signatures etc. PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin … ECDH, EcDSA, EdDSA, Schnorr … Systems Protocols Primitives
  4. Banking, Commerce, Communication … The primitives themselves often need a

    hard to reverse operation, which with elliptic curves is usually scalar multiplication. PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin … ECDH, EcDSA, EdDSA, Schnorr … Scalar Multiplication Systems Protocols Primitives Hard to reverse operation
  5. Banking, Commerce, Communication … Scalar multiplication involves two group operations

    - point addition and doubling. PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin … ECDH, EcDSA, EdDSA, Schnorr … Scalar Multiplication Point Addition, Point Doubling Systems Protocols Primitives Hard to reverse operation Group Operations
  6. Systems Banking, Commerce, Communication … Protocols PKI, TLS, SSH, Wiregaurd,

    Signal, Bitcoin … Primitives ECDH, EcDSA, EdDSA, Schnorr … Hard to reverse operation Scalar Multiplication Group Operations Point Addition, Point Doubling Modular Arithmetic Addition, Subtraction, Multiplication and Inversion.
  7. Most number sets, that we’re used to, are infinite -

    natural numbers, real numbers etc. Elliptic Curve Cryptography, however, relies on arithmetic within a finite set of numbers.
  8. {, , , , } For example we may want

    the result, of adding any two numbers in this set, to also be in this set.
  9. {, , , , } 1+3 =4 is easy because

    the result 4 is in our set. + =
  10. {, , , , } + ≡ mod Perform regular

    integer arithmetic as long as the result is smaller than 5.
  11. {, , , , } + ≡ Perform regular integer

    arithmetic, if the result is greater than 5, divide the result by 5. This remainder is the new result.
  12. Systems Banking, Commerce, Communication … Protocols PKI, TLS, SSH, Wiregaurd,

    Signal, Bitcoin … Primitives ECDH, EcDSA, EdDSA, Schnorr … Hard to reverse operation Scalar Multiplication Group Operations Point Addition, Point Doubling Modular Arithmetic Addition, Subtraction, Multiplication and Inversion.
  13. Use: Tink, Golang Crypto, Rust Crypto, BearSSL, dalek-cryptography … Don’t

    use any of this code in your app! https://gist.github.com/mrinalwadhwa/1b3c0a6c6da74065d2baf755a8fc90e8 ECDH - Elliptic Curve Diffie-Hellman key exchange implemented from scratch with everything we learnt in this talk