I was wondering about how private keys are stored in wallet.dat.
I use bitcoin core 0.9.0 as my hot-wallet, I have a series of public keys i use for different purposes.
If I import a private key with the command: importprivkey (e.g. a selfgenerated vainity key)
Will this key just be added to wallet.dat in equal terms as the other private keys, which bitcoin-core has generated?
What happen if this newly imported private key later get compromised? This will compromise funds send to the corresponding public key, right?
I know I have almost answered the questions my self, just want to have a confirmation that I understood the application correct.
Is there any good know practices about using vanity keys? Should they be also be kept separate from you other keys, or is it find to use bitcoin-core to manage all your private keys?
Yes in Qt it is just the same as the pregenerated ones and any future ones you may generate. If it gets compromised, it is the same as for any other private key, those funds can easily be moved and you'll unfortunately lose access to them. Vanity keys are exactly the same as the keys that are used normally, just that they have been found by bruteforcing private keys to match a specific pattern, so treat them no differently.
On a side note, if you're creating vanity addresses, try and make compressed keys as there is no reason really not to, and they use less space and IIRC they may lead to you needing less tx fees.