applied Atheros1 commit for error handling around .encrypt

commit 8d7eceb18e3435d8d8b67943093e9f3685bb6eb0