Arthur Bergman wrote:
>
> > On Tue, Aug 07, 2001 at 12:27:18PM -0600, Nathan Torkington wrote:
> > > Arthur Bergman writes:
> > > > How hard is the freenet protocol? I am not up to the task of writing a full
> > > > blown server, but I could possibly write the protocol.
> > >
> > > http://freenet.sourceforge.net/index.php?page=protocol is all the info
> > > I could find on it. I suspect the protocol is fairly easy, but
> > > finding info on it is not.
> >
> > I wrote a little poe-based Freenet protocol analyzer/frobber. It's
> > little more than a line-based client + hex dumps of responses at the
> > moment.
> >
> > I can't get past the Diffie-Hellman public-key mayonnaise handshake.
> > Crypt::DH wants Crypt::Random wants Math::Pari wants not to install.
> > Booger. I'm considering writing "lightweight" versions that use
> > Math::BitVector instead, but bleah!
> >
> > -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net
> >
> Try to manually install Math::Pari, I think the main problem is fscked up POD files.
>
> I installed the entire series of stuff because Net::SSH::Perl wants them. On that
>note I hope to have a SSH driver, akin to fletches SSL driver, ready soon.
you can do DH yourself using Math::GMP, it's trivial, use the
undocumented Math::GMP::powm_gmp() command to do modexp. The DH
algorithm is:
you need a large prime P and a generator g (make them with "openssl
dhparam -2 -noout -text 512" where 512 is whatever bit length of prime
you need and 2 is a fixed "generator" (don't ask))
each guy picks a random number x such that x < (P - 1) probably by
slurping bytes off /dev/urandom, doing $x = new Math::GMP '0x' .
unpack('H*', $randombytes), until $x < ($P - new Math::GMP (1))
compute the exchange value y = (g ** x) mod P using
Math::GMP::powm_gmp($g,$x,$P)
they give you their y, lets call it Y
compute the key value k = (Y ** x) mod P
now you both have the same k