0

I would like to generate the 1024 bit Diffie-Hellman private, public, share key. Diffie-Hellman-Parameters as follows: (1024 bit)

prime (p)= FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF

generator (g)= 5 (0x5)

How can I generate the Private, public and shared key using above p and g using c# code using OpenSSL version.

please guide me.

I have found some samples below but it doesnt help me.

Generate EC Diffie-Hellman public and private key pair

Diffie-Hellman Private Key

https://www.codeproject.com/Articles/1219531/Implement-Diffie-Hellman-in-Csharp

Thanks,

Bruno Rohée
  • 3,436
  • 27
  • 32
Yadav
  • 1
  • 2
  • 1
    why are you concerned with giving the prime 'p'? Surely generating any 1024 private/public key pair is sufficient? – Mitch Wheat Aug 01 '18 at 09:50
  • p and g is common for both the parties. i would like to generate key pairs based on it. – Yadav Aug 01 '18 at 10:15
  • The point being, p and g are irrelevant in your use case. Generate a key and share the public key....job done. https://mitchwheat.com/2018/05/24/how-to-send-large-amounts-of-data-securely/ – Mitch Wheat Aug 01 '18 at 11:10
  • p and g are global elements to generate private key and public keys. My requirement is by providing p and g need key pairs using OpensSSL. any help would be appreciated – Yadav Aug 02 '18 at 08:48
  • The first step with the Diffie-Hellman algorithm is to ensure that both parties are using the same set of parameters (i.e. the same values for p and g). Since parameter generation can be an expensive process this is normally done once in advance and then the same set of parameters are used over many key exchanges. – Yadav Aug 02 '18 at 09:25

0 Answers0