Move exception out of crypto_util

This is a move for @Renelvon's last feedback on the previous PR.