Bonjour, j'essaie maintenant de comprendre le code du client utilisé pour la création du paquet IdentificationMessage.
Cependant dans le fichier AuthentificationManager, la fonction cipherRSA me parait très étrange. La voici.
Savez-vous comment fonctionnent les goto en as3? Auriez-vous une version de cette fonction dans laquelle les noms de variables seraient plus explicites?(2.29)J'ai bien regardé la fonction cipherRSA sur le dépot des sources, mais c'est pour la 2.26 ou encore la 2.18 alors ne sachant pas si la méthode a changée ou pas je ne m'en inspire pas.
Merci pour votre aide!
PS:voici la methode pour la 2.18, elle est bien plus claire:
Cependant dans le fichier AuthentificationManager, la fonction cipherRSA me parait très étrange. La voici.
Code:
private function cipherRsa(param1:String, param2 : String, param3 : TrustCertificate) : Vector.<int>
{
if (_loc7_)
{
var baOut : ByteArray = null;
if (_loc7_)
{
}
var debugOutput : ByteArray = null;
if (_loc6_)
{
loop0:
while (true)
{
var certificate : TrustCertificate = param3;
if (_loc7_)
{
if (_loc6_)
{
addr49:
while (true)
{
baIn.writeUTFBytes(this._salt);
if (!_loc7_)
{
addr60:
while (true)
{
var login : String = param1;
if (_loc7_)
{
}
var pwd : String = param2;
if (_loc7_)
{
break;
}
}
continue loop0;
}
break;
}
baIn.writeBytes(this._AESKey);
}
while (true)
{
var baIn : ByteArray = new ByteArray();
if (!_loc6_)
{
§§goto(addr49);
}
§§goto(addr60);
}
}
break;
}
if (_loc6_)
{
}
try
{
§§push(File.applicationDirectory.resolvePath("debug-login.txt"));
if (_loc7_)
{
if (!§§dup(§§pop()))
{
if (!_loc6_)
{
§§pop();
if (_loc6_)
{
}
§§push(File.applicationDirectory.resolvePath("debuglogin.txt"));
}
}
}
if (§§pop())
{
_log.debug("login with certificate");
if (_loc7_)
{
}
debugOutput = new ByteArray();
if (_loc7_)
{
if (_loc7_)
{
}
§§push(baIn);
§§push(0);
if (!_loc7_)
{
§§push((§§pop() - 18 - 24 + 1) * 3);
}
§§pop().position = §§pop();
if (!_loc7_)
{
addr226:
while (true)
{
debugOutput = RSA.publicEncrypt((new PUBLIC_KEY_V2() as ByteArray).readUTFBytes((new PUBLIC_KEY_V2() as ByteArray).length), baIn);
if (_loc6_)
{
}
§§push(_log);
§§push("Login info (RSA Encrypted, ");
if (!_loc6_)
{
§§push(§§pop() + debugOutput.length);
if (!_loc6_)
{
§§push(§§pop() + " bytes) : ");
if (_loc7_)
{
}
}
§§push(§§pop() + Base64.encodeByteArray(debugOutput));
}
§§pop().debug(§§pop());
if (_loc6_)
{
}
break;
}
}
while (true)
{
§§push(debugOutput);
§§push(0);
if (_loc6_)
{
§§push((§§pop() - 1 + 1 - 1 + 61 - 1) * 12);
}
§§pop().position = §§pop();
}
}
while (true)
{
if (!_loc6_)
{
§§goto(addr226);
}
}
}
}
catch (e:Error)
{
if (_loc7_)
{
§§push(_log);
§§push("Erreur lors du log des informations de login ");
if (!_loc6_)
{
§§push(§§pop() + e.getStackTrace());
}
§§pop().error(§§pop());
}
}
baOut = RSA.publicEncrypt(this._publicKey, baIn);
if (_loc7_)
{
if (_loc6_)
{
loop4:
while (true)
{
§§push(baOut);
§§push(0);
if (_loc6_)
{
§§push(§§pop() - 113 - 1 - 20 - 1 + 83 + 1);
}
§§pop().position = §§pop();
if (!_loc6_)
{
if (!_loc6_)
{
if (_loc7_)
{
}
addr381:
§§push(_loc4_);
§§push(0);
if (_loc6_)
{
§§push((§§pop() * 100 + 1 - 1) * 14 + 1);
}
var /*UnknownSlot*/:*= §§pop();
addr465:
if (_loc7_)
{
break;
}
if (_loc6_)
{
}
return ret;
}
addr376:
while (true)
{
if (!_loc7_)
{
§§goto(addr381);
}
else
{
continue loop4;
}
}
}
break;
}
}
while (true)
{
var ret : Vector.<int> = new Vector.<int>();
§§goto(addr376);
}
}
if (_loc6_)
{
}
while (true)
{
§§push(baOut.bytesAvailable);
§§push(0);
if (!_loc7_)
{
§§push((§§pop() + 1 - 1) * 76 - 1 + 12);
}
if (§§pop() == §§pop())
{
break;
}
if (_loc6_)
{
loop8:
while (true)
{
ret[i] = n;
if (_loc7_)
{
if (!_loc6_)
{
if (_loc6_)
{
}
§§push(i);
if (!_loc6_)
{
§§push(§§pop() + 1);
}
var i : int = §§pop();
}
addr442:
while (_loc7_)
{
continue loop8;
}
break;
}
if (_loc7_)
{
break;
}
}
continue;
}
while (true)
{
var n : int = baOut.readByte();
§§goto(addr442);
}
}
§§goto(addr465);
}
while (true)
{
§§push(_loc4_);
§§push(0);
if (_loc6_)
{
§§push(-(§§pop() * 37 + 1 - 1 - 1));
}
var /*UnknownSlot*/:*= §§pop();
if (!_loc6_)
{
§§goto(addr60);
}
§§goto(addr103);
}
}
if (_loc6_)
{
}
if (certificate)
{
baIn.writeUnsignedInt(certificate.id);
if (_loc6_)
{
}
baIn.writeUTFBytes(certificate.hash);
if (_loc6_)
{
addr135:
while (true)
{
baIn.writeUTFBytes(login);
if (_loc6_)
{
}
break;
}
baIn.writeUTFBytes(pwd);
§§goto(addr162);
}
}
while (true)
{
baIn.writeByte(login.length);
if (_loc7_)
{
§§goto(addr135);
}
§§goto(addr157);
}
}
Merci pour votre aide!
PS:voici la methode pour la 2.18, elle est bien plus claire:
Code:
var _loc9_:* = false;
var _loc10_:* = true;
var baOut:ByteArray = null;
var n:* = 0;
var baIn:ByteArray = new ByteArray();
if(certificate)
{
baIn.writeUTFBytes(this._salt);
baIn.writeUnsignedInt(certificate.id);
baIn.writeUTFBytes(certificate.hash);
baIn.writeByte(login.length);
baIn.writeUTFBytes(login);
baIn.writeUTFBytes(pwd);
}
else
{
baIn.writeUTFBytes(this._salt);
baIn.writeByte(login.length);
baIn.writeUTFBytes(login);
baIn.writeUTFBytes(pwd);
}
baOut = RSA.publicEncrypt(this._publicKey,baIn);
var ret:Vector.<int> = new Vector.<int>();
baOut.position = 0;
var i:int = 0;
while(baOut.bytesAvailable != 0)
{
n = baOut.readByte();
ret[i] = n;
i++;
}
return ret;
}