Preferred recoverable method to store passwords in database

后端 未结 1 1828
野的像风
野的像风 2021-01-14 19:27

I want to store some passwords on my database at server.

The passwords should be recoverable, since I want to use them for a third-party api which needs the password

相关标签:
1条回答
  • 2021-01-14 19:44

    AES is cryptographically sound and probably the most common encryption (as opposed to hashing) mechanism selected for new applications.

    Take care to generate a random initialization vector (IV) for each password that you encrypt, and store the Key and the IV separately from the encrypted password bytes.

    To understand differences between AES and Rijndael check out

    http://blogs.msdn.com/b/shawnfa/archive/2006/10/09/the-differences-between-rijndael-and-aes.aspx

    there are some differences between Rijndael and the official FIPS-197 specification for AES

    You should use a unique IV per user. However, storing the key-per-user makes for a complex key management scenario. I would suggest one key for the application and an IV per user.

    The IV can be saved alongside the ciphertext. The key should be stored outside of the database.

    You could store the key, encrypted, in web.config. See this.

    0 讨论(0)
提交回复
热议问题