ABSTRACT While the optical interconnects among computing cores are becoming an enabling technique to build large‐scale artificial intelligence clusters, the growing reliance on multi‐core computing systems also highlights the critical need for strong data security at the chip interconnection level. The increased interconnectivity naturally expands the attack surface and renders the data transfer vulnerable to interception and compromise. Here, we demonstrated a photonic integrated stream cipher that can be physically implemented within the optical I/O package. The optical encryption is realized by dedicatedly designed metasurfaces on a silicon photonic platform, which scrambles optical fields via on‐chip diffraction. The unique optical response of the chip also enables the decryption to recover the original data stream. We also show that the proposed metasurfaces can be flexibly designed to vary the mapping rule and to scale the length of the encryption key. This work provides a possible stream cipher for secure inter‐chip data communications.