Can you not do an input validation in decrypt() before processing?  A regex check maybe?