473,508 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Diffie-Hellman Implementation-Help

Hi guys,
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#.
Any ideas?

Right now i do it as a separate win32 dll
and use PInvoke from c#..

Anyone tried of doin that entirely in C#..

Any exchange of ideas is appreciated.
Thanks and waiting for replies.

Badri
Nov 15 '05 #1
9 7260
Badri,
Somehow I think this is not the correct newsgroup, but while your here...
So you already have a dll, is it one you wrote, or one someone else
supplied? If you wrote it, then it should be a straight forward, although
possibly lengthy, task to re-write using C#. Especially since it was
probably written in C or C++ in the first place.
Regards
Dave
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote in message
news:eU**************@TK2MSFTNGP10.phx.gbl...
Hi guys,
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#. Any ideas?

Right now i do it as a separate win32 dll
and use PInvoke from c#..

Anyone tried of doin that entirely in C#..

Any exchange of ideas is appreciated.
Thanks and waiting for replies.

Badri

Nov 15 '05 #2
Badri,

It should be easy - from a mathematical point of view. Manipulating big
integers is probably the main problem.
I know two ways to solve it.
a. Use the BigInteger class from the Mono project
(http://www.go-mono.com) or it's ancestor at CodeProject;
b. Use the bigInteger class from Microsoft that is included in Visual J#
redist.

Good luck!
--
Sebastien Pouliot
sp******@videotron.ca
http://pages.infinit.net/ctech/poupou.html

"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote in message
news:eU**************@TK2MSFTNGP10.phx.gbl...
Hi guys,
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#. Any ideas?

Right now i do it as a separate win32 dll
and use PInvoke from c#..

Anyone tried of doin that entirely in C#..

Any exchange of ideas is appreciated.
Thanks and waiting for replies.

Badri

Nov 15 '05 #3
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#. Any ideas?
Right now i do it as a separate win32 dll
and use PInvoke from c#..
Anyone tried of doin that entirely in C#..


As Sébastien mentioned, you can use the Mono BigInteger class to implement
it. That's exactly what I've done, so if you're interested here's the code:
http://www.mentalis.org/downloads/DH.zip
It appears to work perfectly but I haven't tested whether it's compatible
with other Diffie Hellman implementations. I assume it is, but I'd like to
verify that before I officially publish the code. I would appreciate it if
you could verify this for me, since you already have a working DH
implementation. I tried to write a C# wrapper around the CryptoAPI to verify
my managed code, but I ran into some problems.

Regards,
Pieter Philippaerts
Nov 15 '05 #4
"Pieter Philippaerts" <Pi****@nospam.mentalis.org> wrote
It appears to work perfectly but I haven't tested whether it's compatible
with other Diffie Hellman implementations.


I just tested against Cipher448's implementation, and everything worked
perfectly.

Regards,
Pieter Philippaerts
Nov 15 '05 #5
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#. Any ideas?
Right now i do it as a separate win32 dll
and use PInvoke from c#..
Anyone tried of doin that entirely in C#..


As Sébastien mentioned, you can use the Mono BigInteger class to implement
it. That's exactly what I've done, so if you're interested here's the code:
http://www.mentalis.org/downloads/DH.zip
It appears to work perfectly but I haven't tested whether it's compatible
with other Diffie Hellman implementations. I assume it is, but I'd like to
verify that before I officially publish the code. I would appreciate it if
you could verify this for me, since you already have a working DH
implementation. I tried to write a C# wrapper around the CryptoAPI to verify
my managed code, but I ran into some problems.

Regards,
Pieter Philippaerts
Nov 15 '05 #6
"Pieter Philippaerts" <Pi****@nospam.mentalis.org> wrote
It appears to work perfectly but I haven't tested whether it's compatible
with other Diffie Hellman implementations.


I just tested against Cipher448's implementation, and everything worked
perfectly.

Regards,
Pieter Philippaerts
Nov 15 '05 #7
Hey thats a cool implementation..
One more Question ..
Will it run under Mono in Linux..???
Thanks and waiting for reply..

"Pieter Philippaerts" <Pi****@nospam.mentalis.org> wrote in message
news:eS**************@TK2MSFTNGP10.phx.gbl...
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote
Anyone tried to do a Diffie-Hellman encryption and decryption totally in c#.
Any ideas?
Right now i do it as a separate win32 dll
and use PInvoke from c#..
Anyone tried of doin that entirely in C#..


As Sébastien mentioned, you can use the Mono BigInteger class to implement
it. That's exactly what I've done, so if you're interested here's the

code: http://www.mentalis.org/downloads/DH.zip
It appears to work perfectly but I haven't tested whether it's compatible
with other Diffie Hellman implementations. I assume it is, but I'd like to
verify that before I officially publish the code. I would appreciate it if
you could verify this for me, since you already have a working DH
implementation. I tried to write a C# wrapper around the CryptoAPI to verify my managed code, but I ran into some problems.

Regards,
Pieter Philippaerts

Nov 15 '05 #8
Thanks for the reply...David
Actually everthing works fine for me when there is a wrapper created but it
does not run under Mono in Linux..
It says thereis a Out of sync error..
Any guesses??

"David Bolt" <da******@compuserve.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Badri,
Somehow I think this is not the correct newsgroup, but while your here...
So you already have a dll, is it one you wrote, or one someone else
supplied? If you wrote it, then it should be a straight forward, although
possibly lengthy, task to re-write using C#. Especially since it was
probably written in C or C++ in the first place.
Regards
Dave
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote in message
news:eU**************@TK2MSFTNGP10.phx.gbl...
Hi guys,
Anyone tried to do a Diffie-Hellman encryption and decryption totally in

c#.
Any ideas?

Right now i do it as a separate win32 dll
and use PInvoke from c#..

Anyone tried of doin that entirely in C#..

Any exchange of ideas is appreciated.
Thanks and waiting for replies.

Badri


Nov 15 '05 #9
"Badri Mohan" <bm****@NOSPAMuncc.edu> wrote in message
Hey thats a cool implementation..
One more Question ..
Will it run under Mono in Linux..???
Thanks and waiting for reply..


Yes, it will -- in fact, I just emailed the code to Sébastien to include it
in the Mono runtime.
However there's a bug in the official BigInteger implementation
[http://bugzilla.ximian.com/show_bug.cgi?id=51229] that may cause the
Diffie-Hellman implementation to malfunction. The BigInteger class that I
used for the Diffie-Hellman implementation contains a work-around for this
bug.

Regards,
Pieter Philippaerts
Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2788
by: Conax | last post by:
Hello, This is actually a general programming question but I don't know which newsgroup best to put it so please pardon me. I've always been looking for the best way to get an accurate...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.