I’d like to store user passwords encrypted in a database. I need to use a bidirectional, symetrical encryption, eg. AES (using a hash is not an option in this special case).
Part 1
Is there a significant increased risk in using the string that I need to encrypt as the key? A public available (same row) salt is added to the key, if that matters.
Part 2
The same question, but applied to the following scenario:
- A is encrypted with B as the key (including salt) and
- B is encrypted with A as the key (including salt).
Both encrypted values are stored in the same database row.
Part 1
As long as your string password is long enough and your function to convert the string into a key is robust, then there are no special security concerns attached to using a string password this way.
Part 2
To prevent against replay attacks involving the first block, you should always salt. Either inject a nonce into the IV, or inject at the head of the stream being encrypted.