An electronic key system comprising a combination of: a vehicle comprising a power unit and vehicle components; a program execution device comprising program execution device side recording means storing a program at least part of which is encrypted and program executing means for executing said program when said encrypted part of said program is decoded; and an electronic key comprising electronic key side recording means recording decoding information needed for decoding said encrypted part of said program, wherein said electronic key comprises transmitting means for transmitting said decoding information to said program execution device, and said program execution device comprises receiving means for receiving said decoding information from said transmitting means and decoding means for decoding said encrypted part of said program by using said decoding information that is received by said receiving means, said program execution device is configured to control a predetermined driving device for performing a physical action by having said program executing means execute said program, said program execution device is mounted on the vehicle and said driving device is the power unit of said vehicle, component information needed for decoding said encrypted part of said program is fixedly added to part of a component constituting said vehicle, said decoding means has receiving means for receiving input of said component information or decoding said encrypted part of said program, and said decoding means is configured to decode said encrypted part of said program by using both said decoding information and said component information, wherein said component information is either drawn on part of the component constituting said vehicle as information that can be recognized by image recognition, or data recorded in a recording medium that is provided on part of the component constituting said vehicle, or a combination of both and the electronic key system comprises either: image pick-up means for picking up an image of said component information when said decoding means decodes said encrypted part of said program; image processing means for generating said component information by image recognition from the image picked up by said image pick-up means; and input means for inputting data of said component information generated by said image processing means to said receiving means, or reading out means for said decoding means to read out data of said component information from said recording medium in decoding said encrypted part of said program; and input means for inputting data of said component information read out by said reading out means to said receiving means, or a combination of both. image pick-up means for picking up an image of said component information when said decoding means decodes said encrypted part of said program; image processing means for generating said component information by image recognition from the image picked up by said image pick-up means; and input means for inputting data of said component information generated by said image processing means to said receiving means, or reading out means for said decoding means to read out data of said component information from said recording medium in decoding said encrypted part of said program; and input means for inputting data of said component information read out by said reading out means to said receiving means, or a combination of both.