I know there are several issues about encryption, but my case is slightly different
- Users have confidential information stored on their device
- They have a RSA key pair
- The information must be encrypted and sometimes shared with another user in a secure manner. The server in no case can know the contents of this information
Options
1) Encryption on the device with the public key and decryption with the private key. When the user wants to share data, encrypts it with the public key of the third party and sent by the server. The user decrypts them with the private key
2) There is a HMAC encryption key for data. The secret key is encrypted on the device with the public RSA key and decrypted with the private key to be used. There is an encrypted copy of the data in the server. When the user wants to share data, encrypts the secret key with the public RSA key of the other user and link to acopy of the data in the server
Pros and cons
1) Encryption and decryption slow. Data synchronization requires a copy per user. An evil user does not put the system at risk
2) Encryption is faster. There may be a copy of the data server and sent only the key. Delete a contact involves renewing the key and distribute?
My question is which option to choose and in the case of 2, which can have security issues