Moved encryption and decryption into a service.