I'm following a course on cryptography and they model messages and keys as random variables, say $X$ and $K$.
In that context one proves for example Shannon's theorem:
Perfect secrecy implies that the support of K is at least as large as the support of X.
I wonder what are the domain and codomain of these random variables. Normally, it should be the case that $X: \Omega \rightarrow \mathbb{R}$ where $\Omega$ is probability space. Can you clarify me this point?
Although in principle that's what Kolmogorov tells us a random variable is, probabilists usually don't worry about specifying the sample space $\Omega$ too precisely. Here $\Omega$ might depend on what process you are using to generate your messages and keys.
The codomains can be taken to be the set of all (finite) strings in a given alphabet. They can be identified with the natural numbers, since we can always use a binary encoding.