A method of generating a dynamic security code for a card not present, CNP, transaction performed by a user using a user electronic device separate from a card, the CNP transaction using card details of the card, wherein the card stores an identifier which identifies a time key (time-key_ID) stored at the card used to authenticate a message, the method comprising: receiving, at the user electronic device, a user request to generate a dynamic security code via a user input device of the user electronic device; responsive to the received user request, sending, at the user electronic device, a request to generate a dynamic security code to the card via a device-to-card interface; sending, at the user electronic device, a request for the identifier to the card via the device-to-card interface; upon receiving of the request for the identifier at the card, sending, at the card, the identifier to the user electronic device via the device-to-card interface; sending, at the user electronic device, a time request to a time source external to the user electronic device, and sending the identifier to the time source with the time request; in response to the time request, receiving, at the user electronic device, a message comprising a time from the time source, wherein the message comprises a Message Authentication Code, MAC, the MAC being computed using the time key associated with the identifier; responsive to the message reception, sending, at the user electronic device, the message comprising the time to the card via the device-to-card interface; upon receiving the message comprising the time at the card, determining, at the card, an authenticity of the message comprising the time, the determining of the authenticity of the message comprising: computing a Message Authentication Code at the card using a key (time-key_ID) stored at the card; and comparing the computed Message Authentication Code with the Message Authentication Code in the received message; and computing the dynamic security code as a function of the time and a key stored at the card, and sending the dynamic security code to the user electronic device via the external card interface, wherein at least one of the computing the dynamic security code and the sending the dynamic security code are performed only if the message comprising the time is determined to be authentic; upon receiving the dynamic security code at the user electronic device, causing, at the user electronic device, the dynamic security code to be displayed on a display of the user electronic device. receiving, at the user electronic device, a user request to generate a dynamic security code via a user input device of the user electronic device; responsive to the received user request, sending, at the user electronic device, a request to generate a dynamic security code to the card via a device-to-card interface; sending, at the user electronic device, a request for the identifier to the card via the device-to-card interface; upon receiving of the request for the identifier at the card, sending, at the card, the identifier to the user electronic device via the device-to-card interface; sending, at the user electronic device, a time request to a time source external to the user electronic device, and sending the identifier to the time source with the time request; in response to the time request, receiving, at the user electronic device, a message comprising a time from the time source, wherein the message comprises a Message Authentication Code, MAC, the MAC being computed using the time key associated with the identifier; responsive to the message reception, sending, at the user electronic device, the message comprising the time to the card via the device-to-card interface; upon receiving the message comprising the time at the card, determining, at the card, an authenticity of the message comprising the time, the determining of the authenticity of the message comprising: computing a Message Authentication Code at the card using a key (time-key_ID) stored at the card; and comparing the computed Message Authentication Code with the Message Authentication Code in the received message; and computing a Message Authentication Code at the card using a key (time-key_ID) stored at the card; and comparing the computed Message Authentication Code with the Message Authentication Code in the received message; and computing the dynamic security code as a function of the time and a key stored at the card, and sending the dynamic security code to the user electronic device via the external card interface, wherein at least one of the computing the dynamic security code and the sending the dynamic security code are performed only if the message comprising the time is determined to be authentic; upon receiving the dynamic security code at the user electronic device, causing, at the user electronic device, the dynamic security code to be displayed on a display of the user electronic device.