Elliptic Curve Memory Refresher

EC ElGamal
point=f(x, y)
G - point (public)
k - integer (private)
Q=kG - point (public)
r - integer [random integer] (private)
s - integer [secret integer] (private)
M=sG - point [secret point] (private)
C=rG - point [reference point] (public)
E=rQ+M - point [encrypted point] (public)
(C, E) - message [(rG, rkG+M)] (public)
D=k*C - point [decryption point] (private)
M=E−D - point [((rkG+M)-krG)] (private)
note: must generate a unique r/M value/coordinate each time for a given key
note: encryption only works in one direction from public key to private key

~

EC DH
- each side generates a secret integer (r) and multiplies with point G (rG)
- each side sends their point multiplication result (rG) to the other
- each side multiplies their secret integer (r) with the exchanged point r(xG)
- each side can encrypt their results before sending with EC ElGamal

~

You can see point S has the same X, Y coordinates in the client as in the server and only points C and E were published!

~

Source Code: github.com/stoops/vpn/blob/main/lib/key.c

Key Generator: github.com/stoops/eckx/blob/main/ecdh.c

~

Leave a comment