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);
}

1 Answer 1

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).

Sign up to request clarification or add additional context in comments.

1 Comment

...anything missing from my answer, Ashley?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.