I am trying to complete a code stock from the by.bloody.crypto 2016 library to use a background worker maybe to use it with a WebSocket communication.
https://github.com/agera-air/org.agera.crypto
If you run the run/test
script using AS&MXML, with this test:
package {
import flash.display.Sprite;
import org.agera.crypto.*;
import org.agera.util.*;
public class Main extends Sprite {
public function Main() {
encrypt("Some string", EncryptionFormat.BASE_64)
.then(function(data: String): void {
assertEquals(data, "U29tZSBzdHJpbmc=");
trace("Base-64 encryption .. OK");
})
.otherwise(function(error: Error): void {
trace("Base-64 encryption .. ERROR");
});
decrypt("U29tZSBzdHJpbmc=", EncryptionFormat.BASE_64)
.then(function(data: String): void {
assertEquals(data, "Some string");
trace("Base-64 decryption .. OK");
})
.otherwise(function(error: Error): void {
trace(error.message);
trace("Base-64 decryption .. ERROR");
});
}
}
}
You get this output:
Base-64 encryption .. OK
Error #1504: End of file.
Base-64 decryption .. ERROR
This is wrong. https://github.com/agera-air/org.agera.crypto/blob/master/packages/org.agera.crypto.worker/src/org/agera/crypto/worker/formats/Base64.as#L111