Linear complexity is an important pseudo-random measure of the key stream sequence in a stream cipher system. The 1-error linear complexity is used to measure the stability of the linear complexity, which means the minimal linear complexity of the new sequence by changing one bit of the original key stream sequence. This paper contributes to calculating the exact values of the linear complexity and 1-error linear complexity of the binary key stream sequence with two prime periods defined by Ding–Helleseth generalized cyclotomy. We provide a novel method to solve such problems by employing the discrete Fourier transform and the M–S polynomial of the sequence. Our results show that, by choosing appropriate parameters p and q, the linear complexity and 1-error linear complexity can be no less than half period, which shows that the linear complexity of this sequence not only meets the requirements of cryptography but also has good stability.