We have designed and developed a 3D digital Lego system as an education tool for teaching security protocols effectively in Information Assurance courses (Lego is a trademark of the LEGO Group. Here, we use it only to represent the pieces of a construction set.). Our approach applies the pedagogical methods learned from toy construction sets by treating security primitives as Lego pieces and protocols as construction results. Simulating the Lego toys, the digital Legos use matching shapes to help students understand the relationships among security primitives and protocols. Specifically, we present a flexible Lego generation method that can use various intuitive shapes to represent abstract and complex security protocols. Our design allows easy generation of new Lego sets and creation of different course materials. The integrated system also provides 3D interaction methods that simulate the real Lego building experience. For selected security courses, we have designed sample demonstrations and experiments for a set of important protocols. The initial evaluation results show encouraging feedback from students on using digital Legos in introductory security courses.