An electronic device characterised by comprising: a first non-volatile memory configured to store first encrypted data encrypted with a global key; and an application circuit comprising: a second non-volatile memory configured to store the global key; a first decryption unit coupled to the first non-volatile memory and the second non-volatile memory, and configured to retrieve the global key from the second non-volatile memory and decrypt the first encrypted data with the global key to generate plain data; a local key unit configured to generate or store a local key; an encryption unit coupled to the local key unit, and configured to encrypt the plain data with the local key to generate second encrypted data and overwrite the first encrypted data in the first non-volatile memory with the second encrypted data; a second decryption unit coupled to the first non-volatile memory, and configured to decrypt the second encrypted data using the local key to obtain the plain data; and a functional unit configured to perform operations according to the plain data; wherein: after the encryption unit overwrites the first encrypted data in the first non-volatile memory with the second encrypted data, the application circuit is configured to be restarted, and the first decryption unit is configured to retrieve the global key from the second non-volatile memory, and perform a decryption with the global key; if the decryption fails, the second decryption unit is configured to decrypt the second encrypted data with the local key to obtain the plain data; and if the second encrypted data is decrypted correctly with the local key to obtain the plain data, the functional unit is configured to perform the operations according to the plain data. a first non-volatile memory configured to store first encrypted data encrypted with a global key; and an application circuit comprising: a second non-volatile memory configured to store the global key; a first decryption unit coupled to the first non-volatile memory and the second non-volatile memory, and configured to retrieve the global key from the second non-volatile memory and decrypt the first encrypted data with the global key to generate plain data; a local key unit configured to generate or store a local key; an encryption unit coupled to the local key unit, and configured to encrypt the plain data with the local key to generate second encrypted data and overwrite the first encrypted data in the first non-volatile memory with the second encrypted data; a second decryption unit coupled to the first non-volatile memory, and configured to decrypt the second encrypted data using the local key to obtain the plain data; and a functional unit configured to perform operations according to the plain data; wherein: after the encryption unit overwrites the first encrypted data in the first non-volatile memory with the second encrypted data, the application circuit is configured to be restarted, and the first decryption unit is configured to retrieve the global key from the second non-volatile memory, and perform a decryption with the global key; if the decryption fails, the second decryption unit is configured to decrypt the second encrypted data with the local key to obtain the plain data; and if the second encrypted data is decrypted correctly with the local key to obtain the plain data, the functional unit is configured to perform the operations according to the plain data. a second non-volatile memory configured to store the global key; a first decryption unit coupled to the first non-volatile memory and the second non-volatile memory, and configured to retrieve the global key from the second non-volatile memory and decrypt the first encrypted data with the global key to generate plain data; a local key unit configured to generate or store a local key; an encryption unit coupled to the local key unit, and configured to encrypt the plain data with the local key to generate second encrypted data and overwrite the first encrypted data in the first non-volatile memory with the second encrypted data; a second decryption unit coupled to the first non-volatile memory, and configured to decrypt the second encrypted data using the local key to obtain the plain data; and a functional unit configured to perform operations according to the plain data; wherein: after the encryption unit overwrites the first encrypted data in the first non-volatile memory with the second encrypted data, the application circuit is configured to be restarted, and the first decryption unit is configured to retrieve the global key from the second non-volatile memory, and perform a decryption with the global key; if the decryption fails, the second decryption unit is configured to decrypt the second encrypted data with the local key to obtain the plain data; and if the second encrypted data is decrypted correctly with the local key to obtain the plain data, the functional unit is configured to perform the operations according to the plain data. after the encryption unit overwrites the first encrypted data in the first non-volatile memory with the second encrypted data, the application circuit is configured to be restarted, and the first decryption unit is configured to retrieve the global key from the second non-volatile memory, and perform a decryption with the global key; if the decryption fails, the second decryption unit is configured to decrypt the second encrypted data with the local key to obtain the plain data; and if the second encrypted data is decrypted correctly with the local key to obtain the plain data, the functional unit is configured to perform the operations according to the plain data.