Given a positive integer $n$ and some $a \in \mathbb{Z}/n\mathbb{Z}$, I want to know if there always exists a ring isomorphism $\phi$ between the two rings: $$\frac{\frac{\mathbb{Z}}{n\mathbb{Z}}[X]}{\langle X^2-1\rangle} \text{and} \frac{\frac{\mathbb{Z}}{n\mathbb{Z}}[X]}{\langle X^2-a\rangle}.$$
I haven't been able to find a counter-example, but I haven't been able to prove this either. Any clue anyone?
Side note - My interest in this problem stems from integer factorization algorithms. If the above isomorphism exists and can be computed efficiently, then we can get a randomized polynomial time algorithm for factorising $n$.