VB/VB.Net Signe de vie, MAJ dofus

A

Anonymous

Invité
#1
Bonsoir,

je vien vous apporter un peu d'infos sur la récente MAJ de dofus, pour la connexion:
-il nous faut retraduire tout ce qui est de la case 3 soit IdentificationMessage ainsi que Version (qui n'est pas du plus dur)

Mais préparez vous a passer un noël bien rempli avec :
AuthentificationManager

package com.ankamagames.dofus.logic.connection.managers
{
import __AS3__.vec.*;
import com.ankamagames.dofus.*;
import com.ankamagames.dofus.logic.common.managers.*;
import com.ankamagames.dofus.logic.connection.actions.*;
import com.ankamagames.dofus.logic.game.common.frames.*;
import com.ankamagames.dofus.network.messages.connection.*;
import com.ankamagames.dofus.network.types.secure.*;
import com.ankamagames.jerakine.data.*;
import com.ankamagames.jerakine.logger.*;
import com.ankamagames.jerakine.utils.crypto.*;
import com.ankamagames.jerakine.utils.errors.*;
import flash.utils.*;

public class AuthentificationManager extends Object implements IDestroyable
{
private var _publicKey:String;
private var _salt:String;
private var _lva:LoginValidationAction;
private var _certificate:TrustCertificate;
public var gameServerTicket:String;
public var ankamaPortalKey:String;
public var username:String;
public var nextToken:String;
public var tokenMode:Boolean = false;
static const _log:Logger = Log.getLogger(getQualifiedClassName(AuthentificationManager));
private static var _self:AuthentificationManager;
private static var PUBLIC_KEY:String = "-----BEGIN PUBLIC KEY-----\n" + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHRiGIhIJrNdUJkKGtWC\n" + "sSqIza+2gPsjGXhSoDTOcokq59Et8d8SzgF68RvAZXezPO8tnUhlyvaDem4QSFLV\n" + "PVAmSRcp47HW4lpp11WHBlDsEEXQTBkM8nDyqSgn8dMANvButRDt/44OKslrfqmV\n" + "7ANmZggZ2wXN0T6XWt3FVC66X8+E7rUMUOREQYCDq3zrX4dNYy3y21lyJZeXTkSd\n" + "AmijqIHrrwLPTA/wpWLCEaIJ9OAWjds8L6TqONXvnf3qOtI/QsrWv24lRjtmRSeR\n" + "eKFIPrk8QQbcd2h4VUi06fJZ2ydCx0pOwU33izN42pmZoCrgdCwghFm1i2feQa0M\n" + "vQIDAQAB\n" + "-----END PUBLIC KEY-----";

public function AuthentificationManager()
{
if (_self != null)
{
throw new SingletonError("AuthentificationManager is a singleton and should not be instanciated directly.");
}
return;
}// end function

public function get salt() : String
{
return this._salt;
}// end function

public function setSalt(param1:String) : void
{
this._salt = param1;
if (this._salt.length < 32)
{
_log.warn("Authentification salt size is lower than 32");
while (this._salt.length < 32)
{

this._salt = this._salt + " ";
}
}
return;
}// end function

public function setPublicKey(param1:Vector.<int>) : void
{
var _loc_2:* = new ByteArray();
var _loc_3:int = 0;
while (_loc_3 < param1.length)
{

_loc_2.writeByte(param1[_loc_3]);
_loc_3++;
}
var _loc_4:* = Base64.encodeByteArray(_loc_2);
this._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----";
return;
}// end function

public function setValidationAction(param1:LoginValidationAction) : void
{
this.username = param1.username;
this._lva = param1;
var _loc_2:* = new MD5();
this._certificate = SecureModeManager.getInstance().retreiveCertificate();
ProtectPishingFrame.setPasswordHash(_loc_2.encrypt(param1.password.toUpperCase()), param1.password.length);
return;
}// end function

public function get loginValidationAction() : LoginValidationAction
{
return this._lva;
}// end function

public function get canAutoConnectWithToken() : Boolean
{
return this.nextToken != null;
}// end function

public function getIdentificationMessage() : IdentificationMessage
{
var _loc_1:IdentificationMessage = null;
var _loc_2:String = null;
var _loc_3:Array = null;
var _loc_4:IdentificationAccountForceMessage = null;
if (this._lva.username.indexOf("|") == -1)
{
_loc_1 = new IdentificationMessage();
if (this._lva is LoginValidationWithTicketAction || this.nextToken)
{
_loc_2 = this.nextToken ? (this.nextToken) : (LoginValidationWithTicketAction(this._lva).ticket);
this.nextToken = null;
this.ankamaPortalKey = this.cipherMd5String(_loc_2);
_loc_1.initIdentificationMessage(_loc_1.version, XmlConfig.getInstance().getEntry("config.lang.current"), " ", this.cipherRsa(_loc_2, this._certificate), this._lva.serverId, this._lva.autoSelectServer, this._certificate != null, true);
}
else
{
this.ankamaPortalKey = this.cipherMd5String(this._lva.password);
_loc_1.initIdentificationMessage(_loc_1.version, XmlConfig.getInstance().getEntry("config.lang.current"), this._lva.username, this.cipherRsa(this._lva.password, this._certificate), this._lva.serverId, this._lva.autoSelectServer, this._certificate != null, false);
}
_loc_1.version.initVersion(BuildInfos.BUILD_VERSION.major, BuildInfos.BUILD_VERSION.minor, BuildInfos.BUILD_VERSION.release, BuildInfos.BUILD_REVISION, BuildInfos.BUILD_PATCH, BuildInfos.BUILD_VERSION.buildType);
return _loc_1;
}
else
{
this.ankamaPortalKey = this.cipherMd5String(this._lva.password);
_loc_3 = this._lva.username.split("|");
_loc_4 = new IdentificationAccountForceMessage();
new IdentificationAccountForceMessage().initIdentificationAccountForceMessage(_loc_4.version, XmlConfig.getInstance().getEntry("config.lang.current"), _loc_3[0], this.cipherRsa(this._lva.password, this._certificate), this._lva.serverId, this._lva.autoSelectServer, this._certificate != null, false, _loc_3[1]);
}
_loc_4.version.initVersion(BuildInfos.BUILD_VERSION.major, BuildInfos.BUILD_VERSION.minor, BuildInfos.BUILD_VERSION.release, BuildInfos.BUILD_REVISION, BuildInfos.BUILD_PATCH, BuildInfos.BUILD_VERSION.buildType);
return _loc_4;
}// end function

public function destroy() : void
{
_self = null;
return;
}// end function

private function cipherMd5String(param1:String) : String
{
var _loc_2:* = new MD5();
return _loc_2.encrypt(param1 + this._salt);
}// end function

private function cipherRsa(param1:String, param2:TrustCertificate) : Vector.<int>
{
var _loc_4:ByteArray = null;
var _loc_7:int = 0;
var _loc_3:* = new ByteArray();
if (param2)
{
_loc_3.writeUTFBytes(this._salt);
_loc_3.writeUnsignedInt(param2.id);
_loc_3.writeUTFBytes(param2.hash);
_loc_3.writeUTFBytes(param1);
}
else
{
_loc_3.writeUTFBytes(this._salt + param1);
}
_loc_4 = RSA.publicEncrypt(this._publicKey, _loc_3);
var _loc_5:* = new Vector.<int>;
_loc_4.position = 0;
var _loc_6:int = 0;
while (_loc_4.bytesAvailable != 0)
{

_loc_7 = _loc_4.readByte();
_loc_5[_loc_6] = _loc_7;
_loc_6++;
}
return _loc_5;
}// end function

public static function getInstance() : AuthentificationManager
{
if (_self == null)
{
_self = new AuthentificationManager;
}
return _self;
}// end function

}
}

Ahhh on l'attendais cette MAJ de noël, MERCI DOFUS !
Cette classe n'est surement rien a côté du 226 a mes yeux...
Je vous propose de nous réunir pour traduire cette classe, voilà ce que moi sa donne :
Imports WindowsApplication1.Dofus
Imports WindowsApplication1.com.ankamagames.dofus.network.messages.connection
Imports WindowsApplication1.Network.Messages.Connexion
Imports WindowsApplication1.com.ankamagames.dofus.logic.connection.actions

Namespace com.ankamagames.dofus.logic.connection.managers
Public Class AuthentificationManager

Private _publicKey As String
Private _salt As String
Private _lva As LoginValidationAction
Private _certificate As TrustCertificate
Public gameServerTicket As String
Public ankamaPortalKey As String
Public username As String
Public nextToken As String
Public tokenMode As Boolean = False
Static Const _log As Logger = Log.getLogger(getQualifiedClassName(AuthentificationManager))
Private _self As AuthentificationManager
Private PUBLIC_KEY As String = "-----BEGIN PUBLIC KEY-----\n" + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHRiGIhIJrNdUJkKGtWC\n" + "sSqIza+2gPsjGXhSoDTOcokq59Et8d8SzgF68RvAZXezPO8tnUhlyvaDem4QSFLV\n" + "PVAmSRcp47HW4lpp11WHBlDsEEXQTBkM8nDyqSgn8dMANvButRDt/44OKslrfqmV\n" + "7ANmZggZ2wXN0T6XWt3FVC66X8+E7rUMUOREQYCDq3zrX4dNYy3y21lyJZeXTkSd\n" + "AmijqIHrrwLPTA/wpWLCEaIJ9OAWjds8L6TqONXvnf3qOtI/QsrWv24lRjtmRSeR\n" + "eKFIPrk8QQbcd2h4VUi06fJZ2ydCx0pOwU33izN42pmZoCrgdCwghFm1i2feQa0M\n" + "vQIDAQAB\n" + "-----END PUBLIC KEY-----"

Public Function AuthentificationManager()
Return Me
End Function

Public Function salt() As String

Return Me._salt
End Function

Public Function setSalt(ByVal param1 As String)

Me._salt = param1

While (Me._salt.Count < 32)


Me._salt = Me._salt + " "
End While

Return Me
End Function

Public Function setPublicKey(ByVal param1 As List(Of Integer))

Dim _loc_2 As UInteger = New ByteArray()
Dim _loc_3 As Integer = 0
While (_loc_3 < param1.Count)


_loc_2.writeByte(param1(_loc_3))
_loc_3++
End While
Dim _loc_4 As UInteger = Base64.encodeByteArray(_loc_2)
Me._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----"
Return Me
End Function

Public Function setValidationAction(ByVal param1 As LoginValidationAction)

Me.username = param1.username
Me._lva = param1
Dim _loc_2 As UInteger = New MD5()
Me._certificate = SecureModeManager.getInstance().retreiveCertificate()
ProtectPishingFrame.setPasswordHash(_loc_2.encrypt(param1.password.toUpperCase()), param1.password.Count)
Return Me
End Function

Public Function loginValidationAction() As LoginValidationAction

Return Me._lva
End Function

Public Function canAutoConnectWithToken() As Boolean

return me.nextToken ! = nothing
End Function

Public Function getIdentificationMessage() As IdentificationMessage

Dim _loc_1 As IdentificationMessage = Nothing
Dim _loc_2 As String = Nothing
Dim _loc_3 As Array = Nothing
Dim _loc_4 As IdentificationAccountForceMessage = Nothing
_loc_4.version.initVersion(BuildInfos.BUILD_VERSION.major, BuildInfos.BUILD_VERSION.minor, BuildInfos.BUILD_VERSION.release, BuildInfos.BUILD_REVISION, BuildInfos.BUILD_PATCH, BuildInfos.BUILD_VERSION.buildType)
Return _loc_4
End Function

Public Function destroy()

_self = Nothing
Return Me
End Function

Private Function cipherMd5String(ByVal param1 As String) As String

Dim _loc_2 As UInteger = New MD5()
Return _loc_2.encrypt(param1 + Me._salt)
End Function

Private Function cipherRsa(ByVal param1 As String, ByVal param2 As TrustCertificate) As List(Of Integer)

Dim _loc_4 As ByteArray = Nothing
Dim _loc_7 As Integer = 0
Dim _loc_3 As UInteger = New ByteArray()
_loc_4 = RSA.publicEncrypt(Me._publicKey, _loc_3)
Dim _loc_5 As UInteger = New List(Of Integer)
_loc_4.position = 0
Dim _loc_6 As Integer = 0
while (_loc_4.bytesAvailable !)


_loc_7 = _loc_4.readByte()
_loc_5(_loc_6) = _loc_7
_loc_6++
End While
Return _loc_5
End Function

Public Function getInstance() As AuthentificationManager
Return _self
End Function
End Class
End Namespace

Et sa sous class LoginValidationAction:
Imports WindowsApplication1.Dofus
Namespace com.ankamagames.dofus.logic.connection.actions


Public Class LoginValidationAction

Public username As String
Public password As String
Public autoSelectServer As Boolean
Public serverId As UInteger

Public Function LoginValidationAction()

Return Me
End Function

Public Function create(ByVal param1 As String, ByVal param2 As String, ByVal param3 As Boolean, ByVal param4 As UInteger) As LoginValidationAction

Dim _loc_5 As UInteger = New LoginValidationAction
LoginValidationAction.password = param2
_loc_5.username = param1
_loc_5.autoSelectServer = param3
_loc_5.serverId = param4
Return _loc_5
End Function

End Class
End Namespace
 

soso6o

Contributeur
Inscrit
6 Mai 2011
Messages
108
Reactions
0
#2
Re: Signe de vie, MAJ D.

et dire que je venais de commencer à apprendre le socket avec les sources de overedges je crois que c'est foutu pour moi ><
 

ToOnS

Membre Actif
Inscrit
8 Avril 2009
Messages
974
Reactions
0
#3
Re: Signe de vie, MAJ D.

lolodu92 a dit:
Code:
        Public Function setSalt(ByVal param1 As String)

            Me._salt = param1

            While (Me._salt.Count < 32)


                Me._salt = Me._salt + " "
            End While

            Return Me
        End Function
bonsoir , je ne comprend cette fonction de mutant , surtout ca :
Code:
While (Me._salt.Count < 32)
                Me._salt = Me._salt + " "
            End While
une petite explication serait bienvenue :mrgreen:
 
A

Anonymous

Invité
#4
Re: Signe de vie, MAJ D.

Code:
While (Me._salt.Count < 32)
                Me._salt = Me._salt + " "
            End While
En gros si le salt qui est l'ancienne key du paquet 3 est plus courte que 32 de longueur il lui rajoute des espaces pour qu'ils atteignent la dites longueur de 32 donc un salt de "jidheurhdiwhdjwijdnskfirjsd" deviendrait "jidheurhdiwhdjwijdnskfirjsd _ _ " les _ sont des espaces , car on ne peut pas mettre plusieurs espaces d'affilé sur ce forum
 
A

Anonymous

Invité
#5
Re: Signe de vie, MAJ D.

Code:
public function setPublicKey(param1:Vector.<int>) : void
{
var _loc_2:* = new ByteArray();
var _loc_3:int = 0;
while (_loc_3 < param1.length)
{

_loc_2.writeByte(param1[_loc_3]);
_loc_3++;
}
var _loc_4:* = Base64.encodeByteArray(_loc_2);
this._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----";
return;
}// end function
Ceci ne vous interpelle pas ?
 
A

Anonymous

Invité
#6
Re: Signe de vie, MAJ D.

Bah c'est pour la key, pourquoi, qu'est-ce-qui a ?
 

ToOnS

Membre Actif
Inscrit
8 Avril 2009
Messages
974
Reactions
0
#7
Re: Signe de vie, MAJ D.

il y a ca viewtopic.php?p=9179#p9179
Code:
var _loc_4:* = Base64.encodeByteArray(_loc_2);
this._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----";
toi tu as ca :
Code:
Dim _loc_4 As UInteger = Base64.encodeByteArray(_loc_2)
 Me._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----"
je comprend le "Je vous propose de nous réunir pour traduire cette classe"
un uinteger c'est un tableau de bytes en base 64 (ou autrement appellé ulong) ?
http://www.siteduzero.com/tutoriel-3-13 ... html?all=1 partie 1 (La théorie et les bases) chapitre 3 (Les variables) et chapitre 8 (Les Tableaux) depuis le temps que je te le dit ca te fera pas de mal meme si ca parle pas de bytes en base 64 (ulong) au moins ca parle des (u)integers et des tableaux
 
Inscrit
29 Septembre 2011
Messages
393
Reactions
3
#8
Re: Signe de vie, MAJ D.

j'aurais pluto fait sa moi
Code:
var _loc_4:* = Base64.encodeByteArray(_loc_2);
this._publicKey = "-----BEGIN PUBLIC KEY-----\n" + _loc_4 + "-----END PUBLIC KEY-----";
Code:
dim _loc_4 as byte = Base64.encodeByteArray(_loc_2);
me._publicKey = "-----BEGIN PUBLIC KEY-----\n" & _loc_4 & "-----END PUBLIC KEY-----";
 

ToOnS

Membre Actif
Inscrit
8 Avril 2009
Messages
974
Reactions
0
#9
Re: Signe de vie, MAJ D.

et moi ca :
dim _loc_4 = Base64.encodeByteArray(_loc_2) ' quand on sait pas on met pas ;)
 
Inscrit
29 Septembre 2011
Messages
393
Reactions
3
#10
Re: Signe de vie, MAJ D.

Ouai tu a a pas tor :)
 

4R7Y

Contributeur
Inscrit
6 Mars 2011
Messages
213
Reactions
0
#11
Re: Signe de vie, MAJ D.

encodeByteArray => Semble être un tableau de byte mais sans grande certitude (mon niveau d'anglais quoi)
 
A

Anonymous

Invité
#12
Re: Signe de vie, MAJ D.

Loc4 est un string ...
 

4R7Y

Contributeur
Inscrit
6 Mars 2011
Messages
213
Reactions
0
#14
Re: Signe de vie, MAJ D.

Byte => Byte
Array => Tableau

+ Encode => tout est dit :p
 
Haut Bas