Using some electronic components can be made a very simple electronic lock. The electronic lock is based on a single active components. The keyboard can be purchased from the store or can be made using "push buttons".
Four buttons are connected in series (those marked with S1 + S4 in the scheme) between plus and the power transistor T1 through a 1k resistor.
The other four buttons (marked with S5 + S8 in the diagram) are connected in parallel with R2, between the T1 and ground. Relay will be activated only if S1-S4 are pressed, while none of the buttons is pressed S5-S8.
If at least one button is pressed this second group, the transistor will be put at the ground, and if one of the buttons S1-S4 is pressed, the transistor will not get the current and be maintained locked by R2.
Voltage of the circuit must be equal to the operating voltage of the relay used (type BD135 transistor can switch up to 0.5 A, while a 2N2222 works up to 0.2 A