title: Using ECDiffieHellmanCng to exchange keys
body: <p>We plan to use ECDHE algorithm to exchange keys between client and server so that both can derive a common secret key to encrypt messages</p>
  
  <p>Based on what I have read, to use ECDHE algorithm both parties (client and server) should agree on a pair of "common" values (p, g) first. Then each party will  use a private key to generate a shared key ie client uses a private key (P1) to generate a shared key (S1) and server uses a private key (P2) to generate a shared key (S2)
  Ref: [<a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Description]" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange#Description]</a></p>
  
  <p>Common value here refers to the common paint. These are actually the mod value (p) and base value (g) used by both parties to generate the shared keys. </p>
  
  <p>Both parties then exchange the shared keys (S1 and S2) and use it with their own private key (P1 or P2) to derive the common secret (K)</p>
  
  <p>When I look at samples that use ECDiffieHellmanCng to generate keys, I do not see an option to specify these "common" values anywhere. In our case, I was expecting both client and server to agree on p and g and then use those values with "ECDiffieHellmanCng" to generate the common shared key. </p>
  
  <p>Ref: <a href="https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.ecdiffiehellmancng?view=netframework-4.7.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.ecdiffiehellmancng?view=netframework-4.7.2</a></p>
  
  <p>I see Alice and Bob create new instance of ECDiffieHellmanCng - do they both internally use the same common values (p and g)?</p>