A non-transitory computer-readable recording medium storing a computer program that causes a computer of a key generation device, which is provided outside a vehicle and executes processing related to a reuse of a used in-vehicle computer and includes a vehicle interface that transmits and receives data to and from a second vehicle on which an in- vehicle computer detached from a first vehicle is installed, to realize processing of:
- generating a root key that is the same as a key stored in the in-vehicle computer from a time when the in-vehicle computer was installed in the first vehicle by using an in-vehicle computer identifier of the in-vehicle computer, and a master key that is common to the first vehicle and the second vehicle;
- transmitting the root key to the second vehicle through the vehicle interface;
- generating a signature key that is the same as a key stored in the in-vehicle computer from the time when the in-vehicle computer was installed in the first vehicle by using the in-vehicle computer identifier and the master key;
- and
- calculating an expected value of the measurement for data applied to the in-vehicle computer by using the signature key that is generated,
- wherein the server device includes a data storage configured to store the data already applied to the in-vehicle computer at a time when the in-vehicle computer is installed in the second vehicle,
- wherein in the calculating of the expected value, the expected value of the measurement for the data is calculated, the data being stored in the data storage and already applied to the in-vehicle computer at the time when the in-vehicle computer, which is detached from the first vehicle and is installed in the second vehicle, is installed in the second vehicle, and
- wherein the measurement result, which is transmitted from the in-vehicle computer, is verified with the expected value.