VB/VB.Net 2.5.5 Password Encryptation

  • Auteur de la discussion Anonymous
  • Date de début
A

Anonymous

Invité
#1
Hi guys.
Im new in this Forum but im an old member of PMG
Im from Brazil, my English isnt perfect but we can understand each other. I dont speak French too but im using google translator to understand all of you.
So.. lets go..
Im developing a D2 bot and I was out for a while. After the last update the connection procedures was changed to RSA encrypt and I got some trouble with this
Here is a part of my code that read public key received, encrypt with Salt and password and send it back to server in IdentificationMessage
In theory its all right, but I always got the message AuthenticationFailed with Password Incorrect..
Im doing something wrong??

____________________________________________________________________
Trad de Geraff

Salut les gars,
Je suis nouveau sur ce forum mais je suis un ancien membre de PMG.
J'habite au brazil, mon anglais n'est donc pas parfait mais on peut se comprendre les uns les autres. Je ne parle pas Français mais j'utilise google trad pour vous comprendre.

Donc.. Allons-y..
Je développe un bot pour Dofus 2.0 et j'ai du stopper pendant un moment. Après la dernière mise à jour, le système d'identification à été changé par le système RSA et j'ai eu des problèmes avec.
Voici une partie de mon code qui lit une clé public reçue, encrypte avec le Salt and Password et l'envoi au serveur dans IdentificationMessage.
En théorie tout est ok, mais j'ai toujours le message AuthenticationFailed avec mot de passe incorect..
Est-ce que j'ai fait quelque chose de travers?

____________________________________________________________________
Code:
Public Class HelloConnectMessage

        Private _isInitialized As Boolean = False
        Public salt As String = ""
        Public key As List(Of SByte)
        Public Const protocolId As UInt32 = 3

        Public Sub Unpack(ByVal param1 As Dofus.DofusReader, ByVal bot As Utils.Classes.Bot)

            'AS3 the key is Stack of SByte
            Me.key = New List(Of SByte)

            'Read Salt
            Me.salt = param1.ReadString()

            'Get the lenght of key
            Dim _loc_2 = param1.ReadUInt16()
            Dim _loc_3 As UInt32 = 0

            'Read the key
            While (_loc_3 < _loc_2)

                Me.key.Add(param1.ReadSByte())
                _loc_3 = _loc_3 + 1

            End While

            'set salt, function at bottom
            setSalt(salt)

            'Transform the SByte array to Byte array to be converted to base64
            Dim byteKey(key.ToArray().Length - 1) As Byte
            Buffer.BlockCopy(key.ToArray(), 0, byteKey, 0, byteKey.Length)

            'convert the key to get string
            Dim keyString = Convert.ToBase64String(byteKey)

            'using RSAManager
            Dim rsam As New RSAManager()

            'use RSAManager with the key received and converted from game
            Dim data() As Byte = Encoding.UTF8.GetBytes(rsam.Encrypt(bot.Pass & salt, keyString))

            'instance of IdentificationMessage
            Dim IdentificationMessage As New IdentificationMessage

            'init Version
            Dim Version As New Types.Version.Version
            Version.Init(2, 5, 5, 57007, 1, 0)

            'filling IdentificationMessage
            IdentificationMessage.autoconnect = False
            IdentificationMessage.useCertificate = False
            IdentificationMessage.useLoginToken = False
            IdentificationMessage.version = Version
            IdentificationMessage.lang = "pt"
            IdentificationMessage.login = bot.Account
            IdentificationMessage.credentials = data
            IdentificationMessage.serverId = 0

            'send IdentificationMessage
            IdentificationMessage.Pack(bot)

        End Sub

        Public Function setSalt(ByVal param1 As String)

            Me.salt = param1
            If (Me.salt.Count < 32) Then
                While (Me.salt.Count < 32)
                    Me.salt = Me.salt & " "
                End While
            End If
            Return Nothing
        End Function
End Class
 
A

Anonymous

Invité
#3
lolodu92, its not the problem, Im already using it..
I think that the problem is on my Salt or Key decrypt from server
 

Sparkdaemon

Staff
Membre du personnel
Inscrit
7 Avril 2009
Messages
556
Reactions
3
#4
If u're a old member of PMG, You know surely Bouh2, He's talked about this on his blog (I don't remember the URL, I'm searching it) and as i now, He find a solution about this.
(Bad english sry)
I search the link.
 
A

Anonymous

Invité
#5
I made it work with the code of maxou..
i was almost there =P
thankz

!close
 
Inscrit
3 Novembre 2011
Messages
51
Reactions
0
#6
What is the solution?

The difference with your code et code of maxou ?
Thanks ;)
 
Haut Bas