0
$\begingroup$

I am working on a messaging client similar to Signal. I am stuck on implementing Tripartite Diffie-Hellman handshake in which three DH exchanges are combined to authenticate both parties and produce a session. Alice starts with identity key $g^A$ and ephemeral key $g^a$ (her secrets are $A$ and $a$). Similarly Bob has identity key $g^B$ and ephemeral key $g^b$ (his secrets are $B$ and $b$). Alice send Bob $g^A$ and $g^a$ and he sends back $g^B$ and $g^b$. Their initial shared secret is:

enter image description here

Now my question is to how to implement $g^{a*B}$ which are both public keys? Also the code to calculate DH share for private with public key is working which is as follow:

enter image description here

Thanks.

$\endgroup$
1
$\begingroup$

Now my question is to how to implement $g^{a*B}$ which are both public keys?

Just given $g^a$ and $g^B$, this is a hard problem (or so we hope); if that is feasible, the strength of the entire system falls apart.

However, both Alice and Bob can compute: for Alice, she computes $(g^B)^a$ (given the value $g^B$ from Bob and her secret $a$). Similarly, Bob computes $(g^a)^B$ (given the value $g^a$ from Alice and his secret $B$)

Both computations yield the common value $g^{a\cdot B}$

$\endgroup$
  • $\begingroup$ g^a and g^B are known. I need to multiply them in elliptic curve for p256. $\endgroup$ – Tahir Abbas Mar 25 at 13:13
  • 2
    $\begingroup$ @TahirAbbas: you can't, you need to know either $a$ or $B$ $\endgroup$ – poncho Mar 25 at 13:47
  • $\begingroup$ @TahirAbbas Multiplying $g^a$ and $g^B$ would not result in $g^{aB}$ but in $g^{a+B}$. $\endgroup$ – Maeher Mar 25 at 21:09
  • $\begingroup$ Yes thats correct. I solved the question this way. I had to multiply g^a with private key B instead of g^b to get g^(aB). Thankyou. $\endgroup$ – Tahir Abbas Mar 26 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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