The invention relates to a key storage method. The method comprises the following steps: generating a true random number by using a hardware random number generator, wherein the true random number isused as an encryption factor of the present storage; generating a seed by using the true random number, and substituting the seed into a linear feedback shift register to obtain a pseudo random number; performing an xor operation on a master key and the pseudo random number to obtain a random master key, and then encoding the random master key by using an error correcting code algorithm to obtainencoded data; performing private algorithm transformation on the true random number to obtain intermediate data, wherein the intermediate data are used as error locations of data to be stored to tamper the encoded data to obtain error code data; and performing encrypted storage on the error code data. According to the key storage method provided by the invention, the generated random number is hidden in the data to be protected, thereby improving the intensity of data randomization. In the case of limited storage resources, in order to prevent brute force attacks after ciphertext leakage, thedata are mixed with error codes, and the data are encrypted by using a private algorithm, so that the key storage is more secure.