Previous work showed that the X network with M transmitters, N receivers has MN/(M+N-1) degrees of freedom. In this work we study the degrees of freedom of the X network with secrecy constraints, i.e. the X network where some/all messages are confidential. We consider the $M times N$ network where all messages are secured and show that N(M-1)/(M+N-1) degrees of freedom can be achieved. Secondly, we show that if messages from only M-1 transmitters are confidential, then MN/(M+N-1) degrees of freedom can be achieved meaning that there is no loss of degrees of freedom because of secrecy constraints. We also consider the achievable secure degrees of freedom under a more conservative secrecy constraint. We require that messages from any subset of transmitters are secure even if other transmitters are compromised, i.e., messages from the compromised transmitter are revealed to the unintended receivers. We also study the achievable secure degrees of freedom of the K user Gaussian interference channel under two different secrecy constraints where 1/2 secure degrees of freedom per message can be achieved. The achievable scheme in all cases is based on random binning combined with interference alignment.