Security in wireless sensor networks demands an efficient key management scheme. As sensors typically operate unattended, it becomes quite important to ensure security to cryptographic keys stored in their memories. In this scenario, the development of lightweight encryption mechanisms is a challenge because of sensor-constrained resources. In this work, we present a mechanism tailored to sensor networks called SENSORLock applying it to a specific case. Our main contribution is to propose, analyze, and demonstrate the feasibility of SENSORLock for secure symmetric key distribution solving the stored key exposure problem. Analytical results demonstrate that this approach increases the system's security against the tampering of sensor nodes. Additionally, the mechanism is evaluated using simulation and practical experiments, using the TinyOS platform. Simulation results reveal that this scheme introduces very low processing overhead, in the order of nanoseconds, and an estimated power consumption quite similar to existing approaches. Besides, practical experiments indicate that the scheme can be deployed by off-the-shelf sensors, such as MicaZ and TelosB. Copyright © 2013 John Wiley & Sons, Ltd.