A method of encrypting data, the method comprising: generating , by a primary data service application on an electronic device (102; 200), a primary ephemeral key pair; generating, by the primary data service application , a first primary secret key based on the primary ephemeral key pair and a primary master public key, wherein the primary master public key is part of a key pair that is associated with the primary data service application; generating , by the primary data service application , a first primary ciphertext by encrypting a first portion of the data using the first primary secret key; generating a second primary secret key based on the first primary secret key; deleting the first primary secret key; sending the first primary ciphertext from the primary data service application to a secondary data service application ; receiving, by the primary data service application , a first encrypted text from the secondary data service application, wherein the first encrypted text is generated by encrypting the first primary ciphertext; generating , by the primary data service application , a second primary ciphertext by encrypting a second portion of the data using the second primary secret key; deleting (342a; 350a) the second primary secret key; sending the second primary ciphertext from the primary data service application to the secondary data service application; and receiving, by the primary data service application , a second encrypted text from the secondary data service application, wherein the second encrypted text is generated by encrypting the second primary ciphertext; wherein if it is determined that a third portion of the data is to be encrypted: prior to deleting the second primary secret key, generating , using a key derivation function, a third primary secret key from the second primary secret key. generating , by a primary data service application on an electronic device (102; 200), a primary ephemeral key pair; generating, by the primary data service application , a first primary secret key based on the primary ephemeral key pair and a primary master public key, wherein the primary master public key is part of a key pair that is associated with the primary data service application; generating , by the primary data service application , a first primary ciphertext by encrypting a first portion of the data using the first primary secret key; generating a second primary secret key based on the first primary secret key; deleting the first primary secret key; sending the first primary ciphertext from the primary data service application to a secondary data service application ; receiving, by the primary data service application , a first encrypted text from the secondary data service application, wherein the first encrypted text is generated by encrypting the first primary ciphertext; generating , by the primary data service application , a second primary ciphertext by encrypting a second portion of the data using the second primary secret key; deleting (342a; 350a) the second primary secret key; sending the second primary ciphertext from the primary data service application to the secondary data service application; and receiving, by the primary data service application , a second encrypted text from the secondary data service application, wherein the second encrypted text is generated by encrypting the second primary ciphertext; wherein if it is determined that a third portion of the data is to be encrypted: prior to deleting the second primary secret key, generating , using a key derivation function, a third primary secret key from the second primary secret key. <EOS>