Error handling on encrypt/decrypt