Using a one- way function (e.g. BCrypt) for password handling in password based login is a common approach.
When an application uses a key derived from user’s password for encrypting a private key, is it secure to rely on successful decryption on login?
Registration (all steps performed client- side):
- Derive a key (A) from user’s password (e.g. using PBKDF2 with 100k iterations).
- Use key A to encrypt user’s private key (using authenticated encryption; e.g. AES in GCM mode).
- Store required information in user’s database record (e.g. ciphertext, salt, …).
Login (all steps performed on client- side):
- Load user's database record by username.
- Derive key (B) from user’s password (using same method used on registration).
- Try to decrypt users private key using key B.