Well, firstly, you draw a parallel using the user password to get the encryption key, but since you are talking about it as an alternative, if you are not using Google Sign-On, this means you are talking about using a password with which users will authenticate . It is a bad idea.
Users should be able to change their password for authentication, and this will be a big problem for you if you encrypt it. This will require that you decrypt everything with the old password, and then encrypt it again using the new one.
So, you need to find something that you can pull from the GoogleIdToken, which will never change. Change email addresses, so I will not use this. Perhaps the user ID that you can get with GoogleIdToken.getPayload (). GetSubject () is what you want. Then what you would like to do is to extract the key from this. I would be looking for ways to combine it with other information that the user gives you, which is really a secret.
Richard Schwartz
source share