Patent ID: 8555089

Claim:
A program execution apparatus that operates with switching between a normal mode and a protective mode, the program execution apparatus comprising: a non-transitory memory device storing a program; and a processing device that executes the program and causes the program execution apparatus to: detect tampering of a program that includes an instruction to execute information security processing which uses a key; execute, in the normal mode, the program when the tampering is not detected, and upon detecting the instruction, output a direction to execute the information security processing; control, in the normal mode and upon receiving the direction, switching from the normal mode to the protective mode; and securely store the key in correspondence with the program and, in the protective mode, read the stored key, output the read key, and control switching from the protective mode to the normal mode, wherein said control of the switching from the normal mode to the protective mode receives the key output from said securely storing and executes the information security processing which uses the received key, in the normal mode, said control of the switching from the normal mode to the protective mode, in the normal mode, further receives a direction from another program to execute information security processing, calculates a hash value of the another program, judges whether the calculated hash value matches a stored hash value of the program, and when judging negatively, deletes a stored key of the program stored in correspondence with the stored hash value of the program, said securely storing further securely stores a maximum use count corresponding to the key and, in the protective mode, outputs the maximum use count, the maximum use count indicating a maximum number of times the key is permitted to be used, said control of the switching from the normal mode to the protective mode, in the normal mode, further receives the maximum use count along with the key, stores the received maximum use count, judges whether or not a current use count exceeds the maximum use count, and when judging affirmatively, outputs a direction that instructs new generation, and controls switching to the protective mode, the current use count indicating a number of times the key has been actually used, upon receiving the direction that instructs the new generation, said securely storing, in the protective mode, further generates a new key and a new maximum use count, outputs the generated new key and the new maximum use count, and controls switching to the normal mode, and said control of the switching from the normal mode to the protective mode, in the normal mode, further receives the new key and the new maximum use count, deletes the stored key and the maximum use count, and stores the received new key and the new maximum use count in correspondence with each other.