To provide a locking device capable of preventing the device from being unlocked by a foreign matter such as a picking and, when such a foreign matter is inserted therein, operating an alarm device and a notifying device.
This locking device comprises a light emitting element and a light receiving element installed, opposedly to each other, in a key insert hole of a lock, through-holes enabling the light from the light emitting element to pass drilled in a key body, the line sensor of an optical system crossing a key inserting direction installed in the key insert hole of the lock, an alarm device operated when a light beam not matching the preset width of the line sensor is shielded, a printed circuit board electrically connected to the light receiving element installed in the bottom of the lock, a motor started by a switching element mounted on the printed circuit board, and a rotary body operated by the motor. A lock member is operated by the rotary body.