It's a very quick question, but I couldn't find the answer from the sources I have.
I've been coding EC based D-H key exchange, and I'm almost done with it.
So here's what I've understood so far.
- Michael and Nikita agree on an Elliptic Curve $E:y^2=x^3+ax+b $, a prime number $p$, and a point $P$ on $E$ over $Z/pZ$.
- They choose their secret numbers $m$ (for Michael) and $n$ (for Nikita).
- They exchange $mP$ and $nP$, each calculated by adding $P$ to itself $m$ and $n$ times over $E$ in $Z/pZ$. (I understand how the "addition" works)
- Now by using the $mP$ or $nP$ they got from each other and the secret number they chose ($n$ and $m$) to calculate the shared key $mnP$.
So my question is, how do you calculate $mnP$? No source I have specified what exactly it is, so I'm not sure if it is $(m \times n)P$ or $P$ added $n$ times to $mP$.
Thanks in advance!