Instead of trigonometry I think a simpler approach is using parametric equations and dot products for orthogonality and distance constraint:
Let's place $S$ in the origin, without losing any generality.
The line $A$ can be defined as $A(s)=sa$ where $s$ is a real number and $a$ is a vector with $|a|=1$.
In analogy let's define $C$ to be $C(t)=tc$ with $t$ real and $|c|=1$.
The requirement of $A(s)$ and $C(t)$ being at the same distance from $B$ can be expressed as
\begin{equation}
|A(s)-B|^2 = |C(t)-B|^2
\end{equation}
\begin{equation}
(sa-B)\cdot(sa-B) = (tc-B)\cdot(tc-B)
\end{equation}
\begin{equation}
s^2|a|^2 + |B|^2 - 2s(a \cdot B) = t^2|c|^2 + |B|^2 - 2t(c \cdot B)
\end{equation}
\begin{equation}
s^2 - 2s(a \cdot B) = t^2 - 2t(c \cdot B)
\end{equation}
The second requirement of perpendicularity can be expressed as
\begin{equation}
(A(s) - B) \cdot (C(t) - B) = 0
\end{equation}
\begin{equation}
(sa - B) \cdot (tc - B) = 0
\end{equation}
\begin{equation}
st(a \cdot c) + |B|^2 -s(a\cdot B) -t(c\cdot B) = 0
\end{equation}
Solving this last equation for $s$ gives
\begin{equation}
s = {t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)}
\end{equation}
Substituting this expression $s=s(t)$ into the equidistance condition finally gives the equation:
\begin{equation}
\left({t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)}\right)^2 -
2 \left({t(c \cdot B) - |B|^2 \over t(a \cdot c) - (a \cdot B)}\right)(a\cdot B)
= t^2 - 2t(c \cdot B)
\end{equation}
This is a 4th degree equation in $t$ than when solved provides the solutions. Experimentally I've been able to build cases in which there are 0, 1, 2, 3 or 4 real solutions and therefore I suppose that a closed formula is not going to be really simple.
For a case in which there are 4 distinct solutions consider for example:
a = (0.7832613199545745, 0.3457501646810926, -0.5166802960110005)
b = (0.22437668770758193, -0.7218976823125938, 0.6546135029810183)
c = (-0.4162213502972967, -0.02495946801502962, -0.9089206854908198)
B = (10.598100181328936, -34.09776673318595, 30.91969827848149)
The solutions are (approximately):
s = -324.127866359 , t = -337.34963584
A = (-253.87682043855557, -112.06726317141957, 167.47048193587798)
C = (140.41212095172617, 8.42006744563637, 306.62406225798975)
|A - B| = 307.688710435
|C - B| = 307.688710435
(A - B)·(C - B) = -2.18278728426e-11
s = 16.2368805029 , t = -75.2329758241
A = (12.717720454640398, 5.613904107782358, -8.389276224529821)
C = (31.313570784400618, 1.8777750537577107, 68.38080795757674)
|A - B| = 55.9169479457
|C - B| = 55.9169479457
(A - B)·(C - B) = 6.8212102633e-13
s = -31.0680366312 , t = -59.2027780354
A = (-24.334391380153313, -10.741778781556734, 16.05224236309069)
C = (24.641460215247356, 1.4776698447755863, 53.81062959490106)
|A - B| = 44.5737858532
|C - B| = 44.5737858532
(A - B)·(C - B) = 0.0
s = -169.123690271 , t = 120.065787347
A = (-132.46804487704648, -58.47454376258159, 87.38287835155742)
C = (-49.973944134014694, -2.996778178983093, -109.13027773929545)
|A - B| = 155.724885051
|C - B| = 155.724885051
(A - B)·(C - B) = 9.09494701773e-13