Question

Basically, my understanding of the process so far is that I choose a modulus (p), a generator (g), and a random private key (xa) that is between 1 and p-1, inclusive. The provider chooses a random private key (xb). The shared secret is g ^ (xa * xb) mod p = (g ^ xa) ^ xb mod p = (g ^xb) ^ xa mod p.

I haven't taken math in about three years, so I have no idea what that means (once the mod function is hit) and have no idea why there are three equals signs (my best guess is that those three statements need to equal each other). I'm trying to use Javascript to generate a shared secret for a MAC key to do OpenID requests against Google's servers. Can anyone offer some assistance or clarification?

Was it helpful?

Solution

The process you describe is known as Diffie-Hellman Key Exchange. You can find an implementation for javascript here, for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top