I'm testing decoding base-64 data, reading it efficiently through ApplicationDomain#domainMemory, inside a background worker:
override public function decode(): Array {
...
ApplicationDomain.currentDomain.domainMemory = task.input;
...
}
I've noticed that I'm receiving an "End of file" error exactly from that assignment to domainMemory with a task.input of 16 bytes that has been received from the main worker.
Error #1504: End of file.
I've tested my similiar encode() function and it produces no such error.
MCVE
Run https://github.com/agera-air/org.agera.crypto by running the script run/test with the following requirements:
- Node.js
asconfigc
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");
});
}
}
}
The problem was a minor typo in my code when copying algorithm codes from the
by.blooddy.cryptocryptography library:In
packages/org.agera.crypto.worker/src/org/agera/crypto/worker/formats/Base64.as, changed fromto...