I'm working on a private project where I need to store a users financial data in a database. I'll encrypt this data using AES, and I'll be using scrypt to generate a AES encryption key from a more simple user password.
I also want to be able to tell the user if he is using the correct password when logging in. Speed is not an issue: the program will run on the user's device and not on a multi-user server.
So summarizing: I want to use one password both to encrypt data and authenticate users.
I can see two options for doing this:
Generate a SHA-256 hash from the scrypt output, store the hash in StoredHash and check if SHA256(scrypt("supplied password")) == StoredHash.
Encrypt the scrypt-output of the password using AES in EncryptedScryptOutput using the scrypt-output as the key and store that, and check if scrypt("supplied password") == AESdescrypt(decryptionKey = scrypt("supplied password"), EncryptedScryptOutput).
I (think I :-) am aware of the technical way this should be done, using salts and/or initial vectors. My questions are: Am I correct that both versions will be secure? Would you say that one option is better than the other, and why?