NetworkDesign: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>Hendrik Brummermann
imported>Hendrik Brummermann
Line 23: Line 23:


Almost there: The client has now all the information it needs to actually send the [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageC2SLoginSendNonceNameAndPassword.html C2SLoginSendNonceNameAndPassword]: Its nonce, the username and the value rsaCrypt(xor(xor(client nonce, server nonce), password)). The first field is a bytes array containing the client nonce, the second one a string containing the username and the third one a byte array containing the encrypted password. On reception, the server checks that the hash he received at first is the hash of the nonce he just received. It then decodes the password field, and having the value of the client nonce and its nonce, it gets the value of the password.
Almost there: The client has now all the information it needs to actually send the [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageC2SLoginSendNonceNameAndPassword.html C2SLoginSendNonceNameAndPassword]: Its nonce, the username and the value rsaCrypt(xor(xor(client nonce, server nonce), password)). The first field is a bytes array containing the client nonce, the second one a string containing the username and the third one a byte array containing the encrypted password. On reception, the server checks that the hash he received at first is the hash of the nonce he just received. It then decodes the password field, and having the value of the client nonce and its nonce, it gets the value of the password.

If the username/password combination is correct then the Server must send a [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageS2CLoginACK.html S2CLoginACK] message to tell the client that the message has been correctly processed. It contains information about the last login, so that the user is able to recognize unauthorized usage of his account.


The [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageS2CLoginNACK.html S2CLoginNACK] message is sent from the server to the client to tell the client that its login request was rejected because the username or password is wrong, the account was banned or the server is full. The included result object will tell which of the cases prevented the login.
The [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageS2CLoginNACK.html S2CLoginNACK] message is sent from the server to the client to tell the client that its login request was rejected because the username or password is wrong, the account was banned or the server is full. The included result object will tell which of the cases prevented the login.

If the username/password combination, however, is correct then the Server must send a [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/MessageS2CLoginACK.html S2CLoginACK] message to tell the client that the message has been correctly processed. It contains information about the last login, so that the user is able to recognize unauthorized usage of his account. The client state is changed to "logged in" in this case.
{{br}}
{{br}}