How a key opens a lock