A method of providing a user of an electronic identity document with encrypted data, the data being decryptable by said user using the electronic identity document, the method comprising: - generating an encryption/decryption key for encrypted data transmission between an electronic identity document and a terminal, wherein generating the encryption/decryption key comprises the steps of: a. a reader of the terminal reading predetermined data from the electronic identity document, said predetermined data including at least a first public key; b. a processing unit of the terminal validating the authenticity of the data read; c. the processing unit generating an ephemeral public key; d. the processing unit generating a session key for secure messaging on the basis of the first public key and the ephemeral public key by: e. the terminal obtaining at least part of a file from the electronic identity document as a protected response by simulating reading of the electronic identity document according to a command; and f. generating the encryption/decryption key on the basis of the protected response; - encrypting the data, by the processing unit of the terminal, using the encryption/ decryption key; - transmitting the encrypted data to the user of the electronic identity document, - sending the ephemeral public key and the command to the electronic identity document the electronic identity document providing the encryption/decryption key for decrypting the transmitted encrypted data, by generating the session key for secure messaging on the basis of the first public key, the ephemeral public key, and the protected response provided by the electronic identity document after receiving the command. - generating an encryption/decryption key for encrypted data transmission between an electronic identity document and a terminal, wherein generating the encryption/decryption key comprises the steps of: a. a reader of the terminal reading predetermined data from the electronic identity document, said predetermined data including at least a first public key; b. a processing unit of the terminal validating the authenticity of the data read; c. the processing unit generating an ephemeral public key; d. the processing unit generating a session key for secure messaging on the basis of the first public key and the ephemeral public key by: e. the terminal obtaining at least part of a file from the electronic identity document as a protected response by simulating reading of the electronic identity document according to a command; and f. generating the encryption/decryption key on the basis of the protected response; a. a reader of the terminal reading predetermined data from the electronic identity document, said predetermined data including at least a first public key; b. a processing unit of the terminal validating the authenticity of the data read; c. the processing unit generating an ephemeral public key; d. the processing unit generating a session key for secure messaging on the basis of the first public key and the ephemeral public key by: e. the terminal obtaining at least part of a file from the electronic identity document as a protected response by simulating reading of the electronic identity document according to a command; and f. generating the encryption/decryption key on the basis of the protected response; e. the terminal obtaining at least part of a file from the electronic identity document as a protected response by simulating reading of the electronic identity document according to a command; and f. generating the encryption/decryption key on the basis of the protected response; - encrypting the data, by the processing unit of the terminal, using the encryption/ decryption key; - transmitting the encrypted data to the user of the electronic identity document, - sending the ephemeral public key and the command to the electronic identity document the electronic identity document providing the encryption/decryption key for decrypting the transmitted