Encrypt and decrypt object