Revised EncryptionHelper to handle exceptions and cleaned code.