1
$\begingroup$

I am building a web app to encrypt and decrypt using an ECC algorithm.

I use the following curve parameters:

Prime p = 43
a = 7
b = 3

public key e1 = 11
private key d = 3
let say i want to encrypt character that is on point (38, 12)

So I calculate its cipher which results in

c1 = (11, 32)
c2 = (27, 40)

I'm sure that both of my cipher is correct because I already calculated it manually.

The problem is, when I want to decrypt it, I have to calculate

M = c2 - d * c1
d * c1 = (27, 3)

so,

M = (27, 40) - (27, 3)

Since point (27, 40) and (27, 3) is a straight line, it will resulting point infinity. Beacuse we can’t calculate the lambda since

x2-x1 = 21 - 27 = 0

and the lambda formula is

y2-y2 / x2-x1

and we can’t divide number to zero.

How to solve this problem? How do I get my original point if my cipher resulting point at infinity?

$\endgroup$
3
  • $\begingroup$ 'Since point (27, 40) and (27, 3) is a straight line, it will resulting point infinity.'; actually, not. $(27, 40) - (27, 3) = (27,40) + (27,40)$, that is, we have a point doubling... $\endgroup$
    – poncho
    Feb 24, 2018 at 18:37
  • $\begingroup$ how can (27, 3) can turn to (27, 40) and not (27, -3)? please explain, i dont understand, hehe $\endgroup$
    – hphp
    Feb 24, 2018 at 18:56
  • $\begingroup$ @hphp: $(27,40)$ and $(27,-3)$ represent the same point. Computations are done in $\mathbb{F}_{43}$: $-3 \bmod 43 = 40$. $\endgroup$
    – user94293
    Feb 24, 2018 at 19:11

1 Answer 1

1
$\begingroup$

Summarizing the answer from the comments, starting with poncho:

Since point $(27, 40)$ and $(27, 3)$ is a straight line, it will resulting point infinity.'; actually, not. $(27,40)−(27,3)=(27,40)+(27,40)$, that is, we have a point doubling...

which resulted in

how can $(27, 3)$ can turn to $(27, 40)$ and not $(27, -3)$?

which is resolved by user94293

$(27,40)$ and $(27,−3)$ represent the same point. Computations are done in $\mathbb F_{43}: −3\bmod43=40$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.