I was making a small application to encrypt files and ran into the problem of verifying that the provided key is the correct one when decrypting. My idea was to store the (padded, encrypted) key along with the encrypted file so when you want to decrypt, the program first checks if the first couple of bytes (un-padded) equals the provided key. I'm no security expert and I can't see a problem with the approach but i still have a feeling that this would be a bad practice some how.
Is this approach OK from a security perspective? Is there perhaps already another solution to the initial problem?