so basically I am trying to log user in with a cookie and do not query DB to improve performance
here is a brief idea:
- transmit everything via SSL
- set a Global secret key A and secret key B
- generate a random verification string on registration and password change
- encrypt the verification string with A, store it in cookie
- encrypt the verification string with B, store it in cookie
- when user tries to login, I decrypt each string with A and B, compare if they match
I am wondering if it is a good idea if it is:
how can I actually do the encryption in Java, using bouncycastle ASE-256, Digest or whatever?
how much does this encryption/decryption process affect the performance, when compared with authentication by storing a session variable in a super fast DB like Redis
if it is not: what should I do..