Fix wrong memory allocation in decrypting stage.
Handle multiple keys