Can I secure my key by XORing it with a hashed password?
You are using a Vernam-encryption (simple XOR), as for the one-time pad.

The general principle for Vernam is that it is perfectly secure as long as you never reuse the same key for more than one message, and gets utterly broken as soon as it is reused even once (this is the "two-time pad"). The key here is the hashed password, the message the key.

If one of your encrypted keys is leaked, all others encrypted with the same password are immediately broken, too (since you can get the password hash, which is the actual key). You normally don't want this property in an encryption system, even if it is only used for data which is of random nature and of only temporary use.

Instead, do one of the following things:


Use a real encryption (like a block cipher) with the hashed password as key and the stored key as input.
Use some (random) salt in the hash function, so that each use of the password gives another hash. Store the salt with the XOR-ed key.
Use a key derivation function to derive the actual key from salt and password. Do only store the salt, not the key in any form.


The OpenPGP message format uses some of these, I think.