How to multiply two Public Keys in Elliptic Curve in Go 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: 



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:



Thanks.
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}$