If your given function $\phi (t) = {\Bbb E}(e^{ i t X})$ is the characteristic function of a random variable $X$ whose probability density is $f(x)dx$, then $ \phi(t)$ is the Fourier transform of $f(x)$ and the extremely useful Fourier inversion formula allows us to recover the function $f(x)$ by the general identity $$f(x) = \frac{1}{2\pi} \int_{t=-\infty}^{t=\infty} e^{- i t x} \phi(t) dt$$ (See footnote regarding sign conventions.)
In your example this simplifies to $f(x) =\frac{1}{2\pi} \int_{t=-\pi/2}^{t=\pi/2} \ (\cos t ) \ e^{-i t x} dt$ which turns out to be $$f(x)=\frac{ \cos(\pi x/2)}{ \pi ( 1- x^2)}$$
Plotting the graph of $f(x)$, we see that it fails to be always non-negative; thus $f(x)$ is NOT a probability density.
P.S. Wikipedia and many other sources use a slightly different convention for the Fourier transform (engineer's version) that shuffles the constant $2\pi$ into other places. The version used above is what is used in statistics and in theoretical physics.
See e.g equations 3 and 4 in reference below.
Physicist's Fourier formulas
P.P.S. In response to a comment that raises a subtle issue I would add one clarification.
There is no a priori assumption that $X$ has a density. Since $\phi$ has compact support there is no doubt that it is the Fourier transform of a smooth function $f(x)$. And the uniqueness theorem for Fourier transforms of generalized functions implies that no finite measure $X$ could exist that has the same characteristic function as this $f(x)$. Thus ultimately the pivotal question is whether or not this function $f(x)$ is non-nonnegative.
The other characteristic function mentioned, $\cos t$ did not decay at $\infty$ so by the contrapositive of the Riemann-Lebesgue Lemma it could not be the characteristic function of any absolutely integrable function. Instead it is of course the Fourier transform of a pair of Dirac delta functions (point masses) which are of course generalized functions.