Quantum information and quantum foundations are becoming popular topics for advanced undergraduate courses. Many of the fundamental concepts and applications in these two fields, such as delayed choice experiments and quantum encryption, are comprehensible to undergraduates with basic knowledge of quantum mechanics. In this paper, we show that the quantum eraser, usually used to study the duality between wave and particle properties, can also serve as a generic platform for quantum key distribution. We present a pedagogical example of an algorithm to securely share random keys using the quantum eraser platform and propose its implementation with quantum circuits.