The chaotic modulation and demodulation in injected semiconductor lasers are studied, and a method of chaotic encoding is presented by modulating the phase of external optical injection light in semiconductor lasers. The modulation response function, demodulation response function and demodulation response factor are analyzed by small-signal analysis. It is found there are peak values about 60 MHz and the response functions and the demodulation factor decrease at high modulation frequency. A chaotic modulation-demodulation equation is theoretically deduced and its roots are given. It is found that there is a peak value at low modulation frequency and the demodulation perfomance declines at high frequency, however, modulation-demodulation of 109 Hz frequency is relalized. Synchronization is achieved and is proved feasible numerically in larger parameter range. Secure communication applications are numerically simulated with chaotic modulations of 200 Mb/s rate and 1.4 GHz frequency. Chaotic encoding is also achieved by shifting key on or off a phase-controller to encode chaotic laser state and decoding is realized under the condition of synchronization or unsynchronization. Chaotic phase key shifting is numerically simulated with a bit rate of 10 Mb/s.