Highlighted

How to resolve bug RC4 encrypt-decrypt on iPAD with AIR15 only

New Here ,
Oct 30, 2014

Copy link to clipboard

Copied

Hi everybody,

I have some trouble with AIR15 only, In the past, I created a small game on iPad It could send or receive messge from server. I used lib as3crypto.swc encrypt or decrypt message (RC4). But when I upgrade to AIR15 encrypt-decrypt cannot work ( Another thing about this crash is that it only happens with a release (adhoc or appstore) build but NOT with a debug build). I check so many time but i don't know what is problem here.

Please help me, thanks so much any advice.

P/S: My game have many swf files (code and resource). I must combine multiple SWF files into one.

Class RC4.as

import com.hurlant.crypto.prng.ARC4;

import com.hurlant.util.Base64;

import com.hurlant.util.Hex;

import flash.utils.ByteArray;

public class RC4

{

  private static const key:String = "keytest";

  private static var byteKeys:ByteArray = Hex.toArray(Hex.fromString(key));

  private static var rc4:ARC4 = new ARC4();

  public static function encrypt(clearText:String):String

{

  var byteText:ByteArray = Hex.toArray(Hex.fromString(clearText));

  rc4.init(byteKeys);

  rc4.encrypt(byteText);

  return Base64.encodeByteArray(byteText);

}

public static function decrypt(encryptedText:String):String

{

  var byteText:ByteArray = Base64.decodeToByteArray(encryptedText);

  rc4.init(byteKeys);

  rc4.decrypt(byteText);

  return Hex.toString(Hex.fromArray(byteText));

}

}

TOPICS
Performance issues

Views

219

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to resolve bug RC4 encrypt-decrypt on iPAD with AIR15 only

New Here ,
Oct 30, 2014

Copy link to clipboard

Copied

Hi everybody,

I have some trouble with AIR15 only, In the past, I created a small game on iPad It could send or receive messge from server. I used lib as3crypto.swc encrypt or decrypt message (RC4). But when I upgrade to AIR15 encrypt-decrypt cannot work ( Another thing about this crash is that it only happens with a release (adhoc or appstore) build but NOT with a debug build). I check so many time but i don't know what is problem here.

Please help me, thanks so much any advice.

P/S: My game have many swf files (code and resource). I must combine multiple SWF files into one.

Class RC4.as

import com.hurlant.crypto.prng.ARC4;

import com.hurlant.util.Base64;

import com.hurlant.util.Hex;

import flash.utils.ByteArray;

public class RC4

{

  private static const key:String = "keytest";

  private static var byteKeys:ByteArray = Hex.toArray(Hex.fromString(key));

  private static var rc4:ARC4 = new ARC4();

  public static function encrypt(clearText:String):String

{

  var byteText:ByteArray = Hex.toArray(Hex.fromString(clearText));

  rc4.init(byteKeys);

  rc4.encrypt(byteText);

  return Base64.encodeByteArray(byteText);

}

public static function decrypt(encryptedText:String):String

{

  var byteText:ByteArray = Base64.decodeToByteArray(encryptedText);

  rc4.init(byteKeys);

  rc4.decrypt(byteText);

  return Hex.toString(Hex.fromArray(byteText));

}

}

TOPICS
Performance issues

Views

220

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 30, 2014 0

Have something to add?

Join the conversation