Notices

Overclockers Forums > Software > Programming Tips and Tricks
Programming Tips and Tricks
Forum Jump

C++ Diffie-Hellman Client

Post Reply New Thread Subscribe Search this Thread
 
 
Thread Tools
Old 04-11-10, 12:55 PM Thread Starter   #1
petteyg359

 
petteyg359's Avatar 

Join Date: Jul 2004
Location: University of Southern Mississippi

 
C++ Diffie-Hellman Client


I'm trying to write a client program that connects to a server with Diffie Hellman encryption. I've got two problems.

1. I can't find any examples using C/C++ and DH for connecting to a server. I've found lots of examples that create two DH objects inside the same program, that can "communicate" with each other, but nothing that actually opens a socket and connects to a server running on a different system.

2. The server's prime "key" for DH is already known. It is 128 bits long. How does one deal with 128-bit integers, when the largest type is uint64_t?

__________________
MSI 890GXM-G65 - X6 1055T - 16GiB 10700 - 5850 1GiB - 7 Pro x64 / Gentoo amd64 - HX520
Dell XPS 15 L502x - i7 2760QM - 16GiB 12800 - GT 540M 2GiB - 7 Pro x64 / Gentoo amd64 - Agility 4 512GB

[GB ≠ GiB] [MB ≠ MiB] [kB ≠ kiB] [1000 ≠ 1024] [Giga ≠ gram] [Mega ≠ milli] [Kelvin ≠ kilo] [Byte ≠ bit]
"Apparently, Plaintiff believes that he could sue an egg company for fraud for labeling a carton of 12 eggs a “dozen,” because some bakers would view a “dozen” as including 13 items." - Western Digital 2006
petteyg359 is offline Folding Profile SETI Profile Heatware Profile   QUOTE Thanks
Old 04-11-10, 09:06 PM   #2
johan851
Insatiably Malcontent
Senior Member

 
johan851's Avatar 

Join Date: Jul 2002
Location: Seattle, WA

10 Year Badge
 
Not sure how to help with the C/C++ socket stuff, because I'm not knowledgeable there. Still, it seems that if you know how to do network communication, then the examples of a DH client within one program should be all you need.

Typically long keys are stored as arrays of bytes, not as a single integer. That gives you more flexibility if you want to bump up your key length later. Sometimes DH keys can be quite large - 1024 or 2048 bits.

__________________
ASRock Z68 Extreme3 Gen3 | 2500K @ 4.6GHz | 2x4GB Samsung DDR3 | GTX460 768mb
120GB Crucial M4 | 2x 2TB Samsung F4 | Seasonic S12 600w
AV-710 --> y2 DAC --> Custom M^3 --> Custom LM3875 ChipAmp --> Modula MTs
Dual Dell 2007WFP | Watercooled
johan851 is offline   QUOTE Thanks
Old 06-20-10, 09:22 PM   #3
ShadowPho
Member

 
ShadowPho's Avatar 

Join Date: Jun 2005
Location: I am in your stack, SUBbing your registers!

 
Quote:
Originally Posted by petteyg359 View Post
I'm trying to write a client program that connects to a server with Diffie Hellman encryption. I've got two problems.

1. I can't find any examples using C/C++ and DH for connecting to a server. I've found lots of examples that create two DH objects inside the same program, that can "communicate" with each other, but nothing that actually opens a socket and connects to a server running on a different system.

2. The server's prime "key" for DH is already known. It is 128 bits long. How does one deal with 128-bit integers, when the largest type is uint64_t?
1) winsock.

__________________
"Take only that which you can give"
Need Help? IM me! I want to help the OC community!

MainComputer:
E6400@2.69-4.0 gig RAM-8800GT
ASUS P5N-E SLI

ShadowPho is offline Heatware Profile   QUOTE Thanks

Post Reply New Thread Subscribe


Overclockers Forums > Software > Programming Tips and Tricks
Programming Tips and Tricks
Forum Jump

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Mobile Skin
All times are GMT -5. The time now is 05:02 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
You can add these icons by updating your profile information to include your Heatware ID, Benching Profile ID or your Folding/SETI profile ID. Edit your profile!
X

Welcome to Overclockers.com

Create your username to jump into the discussion!

New members like you have made this the best community on the Internet since 1998!


(4 digit year)

Why Join Us?

  • Share experience
  • Max out your hardware
  • Best forum members anywhere
  • Customized forum experience

Already a member?