Added function to encrypt and decrypt data