  Reconfigurable Intelligent Surface (RIS) assisted physical layer key
generation has shown great potential to secure wireless communications by
smartly controlling signals such as phase and amplitude. However, previous
studies mainly focus on RIS adjustment under ideal conditions, while the
correlation between the eavesdropping channel and the legitimate channel, a
more practical setting in the real world, is still largely under-explored for
the key generation. To fill this gap, this paper aims to maximize the
RIS-assisted physical-layer secret key generation by optimizing the RIS units
switching under the eavesdropping channel. Firstly, we theoretically show that
passive eavesdropping significantly reduces RIS-assisted secret key generation.
Keeping this in mind, we then introduce a mathematical formulation to maximize
the key generation rate and provide a step-by-step analysis. Extensive
experiments show the effectiveness of our method in benefiting the secret key
capacity under the eavesdropping channel. We also observe that the key
randomness, and unmatched key rate, two metrics that measure the secret key
quality, are also significantly improved, potentially paving the way to
RIS-assisted key generation in real-world scenarios.
