To meet one of my application's needs, I must store an encrypted object in the database. Sometimes, I need to verify whether the user holds the right decryption key without the need to retrieve (decrypt) the stored object, I just need to make sure the user is its original owner.
I've come up with the solution of storing the encrypted object (using say, Fernet) and also its decryption key (hashed, of course) in the same database (maybe even in the same table), so that if I need to verify the ownership of the object I just need to hash the provided password and compare it with the key stored, without having to actually retrieve the encrypted object.
Does this represent any security risk I'm unaware of?