Encrypts and decrypts messages