0

I was using as3Crypto with no probs http://www.zedia.net/2009/as3crypto-and-php-what-a-fun-ride/

but it produces a string which includes equal (and probably other URL Query unsafe characters). Is there a way to encrypt like this?

Current code below:

public function encrypt(txt:String = ''):String
{
    var data:ByteArray = Hex.toArray(Hex.fromString(txt));      
    var pad:IPad = new PKCS5;
    var mode:ICipher = Crypto.getCipher(type, key, pad);
    pad.setBlockSize(mode.getBlockSize());
    mode.encrypt(data);
    return ''+Base64.encodeByteArray(data);
}
skaffman
  • 398,947
  • 96
  • 818
  • 769
Ashley Coolman
  • 11,095
  • 5
  • 59
  • 81

1 Answers1

1

Yes, base 64 encoding is the normal way to do this, although you must still URL escape the result, because Base64 contains unsafe characters as well ('/', '+' and '=' to be precise).

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263