We propose and demonstrate the use of real-time optical signal processing, implemented with integrated and packaged off-the-shelf commercial technology, to enhance the security of data networks. Optical steganography, based on spread spectrum, is used to inhibit the observation of data traffic and the analysis of traffic patterns. Using optical CDMA to modulate the data, service interruption is prevented in presence of infrastructure attacks. Unlike conventional wavelength and time multiplexing approaches, the soft blocking capability of optical CDMA provides protection paths without permanently allocating bandwidth. The large size of the optical CDMA code set also reduces the probability that the secure signal can be intercepted by an eavesdropper. Finally, high-speed all-optical data encryption is demonstrated, which prevents side-channel attacks and enables real-time encryption with no delay.