I want to use bouncycastle in order to perform Diffie-Hellman key exchange between two software components (Alice and Bob). Alice and Bob have their own key pair, issued from the same CA. However, Alice will be Java and Bob will be C#.
I've searched for - and found - examples of how to perform the exchange in each language. But I have 2 issues with the examples that I find:
- The examples over-simplify by implementing the exchange between Alice and Bob in the same block of example code. I'm having trouble understanding what Alice and Bob would look like when they actually have to exchange their intermediate values (g^a mod p and g^b mod p) over an SSL stream.
- The examples are always for software components written in the same language. I've read elsewhere that the Diffie-Hellman key exchange libraries often use some internal constants in order to generate their intermediate values. Based on my knowledge of how DH works, I don't see where any sort of constants would be necessary, but I'm no expert.
Based on those two issues, I have two questions:
- Does anyone know of a code example that shows the code for both sides separately, and
- If I use the bouncycastle APIs for both the java and .net components, does anyone know of any reason why the components would not be able to agree upon the same secret symetric key?