MrChuCong / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Finished SRP #67

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Before updating my local copy of lidgren.network, I finished SRP using the 
default handshakes. 

Maybe this will help you doing yours.

Note: this will not 'just' run. I copied my code (the SRP) parts into a zip. 
Only needs a few lines to be edited to run.

The files are for multiple servers interconnecting. Servers.Handshake should be 
modified if intended for clients (then, isServerconnecting should be false, and 
a username + password should be provided).

Note that I used mono.s BigInteger to serialze the data (as string) because 
ReadBytes[] dit not suffice at the moment.

Derk-Jan

Original issue reported on code.google.com by dj.gaym...@gmail.com on 15 Apr 2011 at 6:23

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Ok. Here is a first version of SRP into Lidgren. It will work plug and play 
with existing code. You can call normal Connect or the new ConnectSRP. 

- You will need a uniform keysize, receiving part needs an ILogonManager 
derived class
- Set the keysize in the configuration (1024 by default) or at connection
- Set the logonManager in the configuration (easiest way). 
- ILogonManager.Lookup needs to return the verifier and salt
- Register new users using something equivalent to NetPeer (static) 
.PasswordVerifier

Handshakes will give you information on succession and/or error and/or denied
- When Handshake fails/denied you will get an HandshakeMessage
- When Handshake succeeded you will get NetConnection (instance) .IsUsingSRP as 
true and receive an HandshakeMessage.

HandshakeMessages carry 1 byte of HandshakeMessageReason (this is a public 
enum, flags) and the rest will be string reason/message OR 32 byte key (on 
succes)

You can also upgrade existing connection to SRP using
NetConnection (instance).UpgradeToSRP(args*). However, no resends are 
automated, so hook an timer of expiration until someone, I or you upgrade this, 
that will restart upgrading - this is still little bit buggy, havn't tested it.

Examples are provided in the UnitTest. 

Original comment by dj.gaym...@gmail.com on 8 May 2011 at 10:45

Attachments:

GoogleCodeExporter commented 8 years ago
Before you can apply the patch, you have to make the following changes:
1. Create a branch from revision 159
2. Move NetSRP.cs to the Lidgren.Network/Authentication folder
3. Apply the patches

Now you should be able to merge the trunk to the srp branch (after fixing some 
conflicts for NetSRP.cs and some others).

Original comment by mark.jun...@gmail.com on 23 Jan 2012 at 8:55

GoogleCodeExporter commented 8 years ago
I attached two patches containing the SRP patches but they can be applied to 
the revision 209.

The first patch is just a simple "port" of the original patch. The second one 
fixes some spelling mistakes. The second patch breaks existing code that uses 
the old SRP patch because the second patch renames some enum values. These 
patches were created with Mercurial but they should be applicable by SVN too.

Original comment by mark.jun...@gmail.com on 23 Jan 2012 at 9:11

Attachments:

GoogleCodeExporter commented 8 years ago
I will re-patch the srp later next week. I rewrote it a bit. Only issue i
have is that Lidgren sometimes fails to establish srp, because the
connecting state is reset when the status becomes: reconnecting.

Original comment by dj.gaym...@gmail.com on 1 Feb 2012 at 8:16

GoogleCodeExporter commented 8 years ago
Just looked at your spelling patch code. It doesn't break anything because
that enumeration is not exposed to the user.
Op 1 feb. 2012 09:16 schreef "Derk-Jan Karrenbeld" <dj.gaymail@gmail.com>
het volgende:

Original comment by dj.gaym...@gmail.com on 1 Feb 2012 at 8:20

GoogleCodeExporter commented 8 years ago
https://github.com/Derkje-J/lidgren-srp6a

There. 

Original comment by dj.gaym...@gmail.com on 3 Dec 2012 at 2:00

GoogleCodeExporter commented 8 years ago
Updated to https://github.com/SleeplessByte/lidgren-srp6a

Original comment by dj.gaym...@gmail.com on 3 Nov 2013 at 1:54