March 04, 2020
390

# 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.

March 04, 2020

## Transcript

1. Elliptic Curve Cryptography
@mrinal
Just enough math, to understand:
Ockam
ockam.io/team

2. Banking, Commerce, Communication …
The systems, we build, rely on various cryptographic protocols to ensure integrity and conﬁdentiality of data that flows within them.
Systems

3. Banking, Commerce, Communication …
PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin …
The systems, we build, rely on various cryptographic protocols to ensure integrity and conﬁdentiality of data that flows within them.
Systems
Protocols

4. Banking, Commerce, Communication …
These protocols are, in turn, constructed by combining well deﬁned cryptographic primitives - key agreement, signatures etc.
PKI, TLS, SSH, Wiregaurd, Signal, Bitcoin …
ECDH, EcDSA, EdDSA, Schnorr …
Systems
Protocols
Primitives

5. 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

6. 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
Systems
Protocols
Primitives
Hard to reverse operation
Group Operations

7. 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
and Inversion.

8. Most number sets, that we’re used to, are inﬁnite - natural numbers,
real numbers etc.
Elliptic Curve Cryptography, however, relies on arithmetic within a
ﬁnite set of numbers.

9. {, , , , }
For example we may want the result, of adding any two numbers in this set, to also be in this set.

10. {, , , , }
1+3 =4 is easy because the result 4 is in our set.
+ =

11. {, , , , }
But, 3+4=7 is not in the set.
+ =

12. Modular
Arithmetic.
Modular arithmetic is way of keeping the result in our ﬁnite set.

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

14. {, , , , }
+ ≡
Perform regular integer arithmetic, if the result is
greater than 5, divide the result by 5. This remainder
is the new result.

15. Calculating a multiplicative inverse.

16. ≡ + + mod
Elliptic Curve over a Finite Field.

17. ≡ + + mod
Elliptic Curve over a Finite Field.

18. Curve P-256 / NIST P256 / secp256r1 / prime256v1

19. Group
Operations

20. Scalar
Multiplication
Multiply a Point with a scalar.

21. Really means ADD a point to itself scalar times.

22. Difﬁe-Hellman
Key Exchange

23. ECDH - Elliptic Curve Difﬁe-Hellman

24. ECDH - Elliptic Curve Difﬁe-Hellman

25. ECDH - Elliptic Curve Difﬁe-Hellman

26. ECDH - Elliptic Curve Difﬁe-Hellman

27. ECDH - Elliptic Curve Difﬁe-Hellman

28. 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
and Inversion.

29. Use: Tink, Golang Crypto, Rust Crypto, BearSSL, dalek-cryptography …
Don’t use any of this code in your app!