Search code examples
securityencryptionaessensitive-data

Encryption algorithm for encypting sensitive-data - AES-256?


In one of my applications, I am to store user credentials and tokens. As the credentials are used directly on third-party services, I cannot hash them and thus need to store them as-is.

As I am not an expert on encryption, I googled and found that AES 256-bit key size-is a good idea to encrypt such data.

I would like to know the opinion of the SO community on the same, before I make a final decision.

Thanks!

Edit: Thanks to all for discussion, I am moving ahead using AES256 as the encryption mechanism for now, which seems like a good choice.


Solution

  • if you ask user for credential every time, then why do you need to store them in db? just keep it in memory and pass to external system. you can even ask user once and keep their password in memory for the whole session. if, for some reason you have to store them in db, them of course encrypt it. as far as i know, current standard is AES256. but still somewhere you have to keep unencrypted key. to sum up: if you want to authenticate users and then use their password only for the time of session then you don't have to store it in database. keep salted hash for authentication purpose and keep user provided password in session for external systems

    btw. is your swap encrypted?