A system comprising: an electronic smoking device comprising: an electric power source for powering an atomizer configured to atomize a liquid supplied from a capsule mounted to the device, control electronics configured to control the atomizer, and a puff detector configured to indicate an aerosol inhaling puff to the control electronics; and the capsule, containing the liquid to be supplied to the atomizer, the capsule being configured to be mounted to the electronic smoking device, wherein the capsule comprises: a controller, which is responsive when mounted to the electronic smoking device to receive data from and to transmit data to the control electronics of the electronic smoking device, via a communication device (50, 51, 52), the control electronics of the electronic smoking device and the controller of the capsule being configured to execute a challenge response authentication when the capsule is mounted to the device, wherein the capsule comprises a shell having an access port at a first end of the shell, wherein the access port is covered by a pierceable membrane, wherein an intermediate wall in the shell provides a cavity between said intermediate wall and a second end of the shell, wherein the cavity is separated from the liquid which is accommodated in a reservoir between the first end of the shell and the intermediate wall, and wherein the controller is in the cavity. an electronic smoking device comprising: an electric power source for powering an atomizer configured to atomize a liquid supplied from a capsule mounted to the device, control electronics configured to control the atomizer, and a puff detector configured to indicate an aerosol inhaling puff to the control electronics; and the capsule, containing the liquid to be supplied to the atomizer, the capsule being configured to be mounted to the electronic smoking device, wherein the capsule comprises: a controller, which is responsive when mounted to the electronic smoking device to receive data from and to transmit data to the control electronics of the electronic smoking device, via a communication device (50, 51, 52), the control electronics of the electronic smoking device and the controller of the capsule being configured to execute a challenge response authentication when the capsule is mounted to the device, wherein the capsule comprises a shell having an access port at a first end of the shell, wherein the access port is covered by a pierceable membrane, wherein an intermediate wall in the shell provides a cavity between said intermediate wall and a second end of the shell, wherein the cavity is separated from the liquid which is accommodated in a reservoir between the first end of the shell and the intermediate wall, and wherein the controller is in the cavity. a controller, which is responsive when mounted to the electronic smoking device to receive data from and to transmit data to the control electronics of the electronic smoking device, via a communication device (50, 51, 52), the control electronics of the electronic smoking device and the controller of the capsule being configured to execute a challenge response authentication when the capsule is mounted to the device, wherein the capsule comprises a shell having an access port at a first end of the shell, wherein the access port is covered by a pierceable membrane, wherein an intermediate wall in the shell provides a cavity between said intermediate wall and a second end of the shell, wherein the cavity is separated from the liquid which is accommodated in a reservoir between the first end of the shell and the intermediate wall, and wherein the controller is in the cavity.