Skip to main content
replaced http://tools.ietf.org/html/rfc with https://www.rfc-editor.org/rfc/rfc
Source Link

If you need to retrieve the plaintext password at some point, then you indeed need encryption and not hashing (beware that many people call "encryption" what really is hashing). I suppose that your "business need" comes from the need to support some protocol where the server must know the plaintext password (e.g. the APOP authentication methodAPOP authentication method in the POP protocol).

The crucial point with encryption is that it is done with a key, which is a very sensitive piece of data, since knowing the key allows decrypting the passwords. Your server will need to know the key when a password must be stored (upon user registration and password change) and when the password must be retrieved (following your business needs). If you store the key in the database itself, as is, then you have gained nothing with encryption: you encrypt the password because you envision the case of an attacker who gets read access to the database contents (e.g. with some SQL injection attack) but not to the whole server.

Your DB might be able to do the encryption for you, without storing the key in an emplacement that could be revealed through SQL injection. You may find some guidance for SQL Server there.

If you need to retrieve the plaintext password at some point, then you indeed need encryption and not hashing (beware that many people call "encryption" what really is hashing). I suppose that your "business need" comes from the need to support some protocol where the server must know the plaintext password (e.g. the APOP authentication method in the POP protocol).

The crucial point with encryption is that it is done with a key, which is a very sensitive piece of data, since knowing the key allows decrypting the passwords. Your server will need to know the key when a password must be stored (upon user registration and password change) and when the password must be retrieved (following your business needs). If you store the key in the database itself, as is, then you have gained nothing with encryption: you encrypt the password because you envision the case of an attacker who gets read access to the database contents (e.g. with some SQL injection attack) but not to the whole server.

Your DB might be able to do the encryption for you, without storing the key in an emplacement that could be revealed through SQL injection. You may find some guidance for SQL Server there.

If you need to retrieve the plaintext password at some point, then you indeed need encryption and not hashing (beware that many people call "encryption" what really is hashing). I suppose that your "business need" comes from the need to support some protocol where the server must know the plaintext password (e.g. the APOP authentication method in the POP protocol).

The crucial point with encryption is that it is done with a key, which is a very sensitive piece of data, since knowing the key allows decrypting the passwords. Your server will need to know the key when a password must be stored (upon user registration and password change) and when the password must be retrieved (following your business needs). If you store the key in the database itself, as is, then you have gained nothing with encryption: you encrypt the password because you envision the case of an attacker who gets read access to the database contents (e.g. with some SQL injection attack) but not to the whole server.

Your DB might be able to do the encryption for you, without storing the key in an emplacement that could be revealed through SQL injection. You may find some guidance for SQL Server there.

Source Link
Tom Leek
  • 174.7k
  • 29
  • 353
  • 485

If you need to retrieve the plaintext password at some point, then you indeed need encryption and not hashing (beware that many people call "encryption" what really is hashing). I suppose that your "business need" comes from the need to support some protocol where the server must know the plaintext password (e.g. the APOP authentication method in the POP protocol).

The crucial point with encryption is that it is done with a key, which is a very sensitive piece of data, since knowing the key allows decrypting the passwords. Your server will need to know the key when a password must be stored (upon user registration and password change) and when the password must be retrieved (following your business needs). If you store the key in the database itself, as is, then you have gained nothing with encryption: you encrypt the password because you envision the case of an attacker who gets read access to the database contents (e.g. with some SQL injection attack) but not to the whole server.

Your DB might be able to do the encryption for you, without storing the key in an emplacement that could be revealed through SQL injection. You may find some guidance for SQL Server there.