I am a beginner, I can understand the basics of ECC and elliptic curve, i can't find where I missed to understand. But I have a great doubt in ECDH regarding below. Could any of you please clarify for me? I will ask with the help of an example.
Let $G=(1,3)$ be the generator point with order $n=18$ for an elliptic curve $E(13,24)\bmod29$. I want to calculate Public key for both Alice and Bob.
Now Let the secret key of Alice be $A=5$ and of Bob be $B=7$ (such that the scalar which is multiplying with $G$ should be less than the order $n$ of the generator point).
Now the public key of Alice is $P_A=A\cdot G=5\cdot G=5(1,3)=(19,7)$
and the public key of Bob is $P_B=B\cdot G=7\cdot G=7(1,3)=(15,6)$
Now after transmitting the public key mutually, the parties have to calculate the shared secret key.
The shared key of Alice is $S_A=A\cdot P_B=5(15,6)=(23,1)$
and the shared key of Bob is $S_B=B\cdot P_A=7(19,7)=\mathcal O$(Point at infinity). The shared secret supposed to be the same. But I am getting the point at infinity instead of $(23,1)$. How to overcome this?
My doubt is,if this is the case how can the sender and receiver get the shared key in ECDH?
If not, kindly quote where I did mistake here and in what i misunderstood?