secure system in the perfect sense a secure system in the perfect sense verifies the definition of perfect security. My question is as follows: There is always a way to check for perfect security by solving the first degree equation by finding k? for example if i have c = (k * m) xor mod7
A sufficient (but not quite necessary*) condition for a cryptosystem to provide perfect secrecy is that:


every key is equally likely (and independent of the message), and
for every message $m$ and every ciphertext $c$, there exists a unique key $k$ such that $k$ encrypts $m$ to $c$.


The relationship between $m$, $c$ and $k$ does not necessarily need to be a linear one; it is sufficient that it be one-to-one, so that we can always find a unique matching key $k$, given $c$ and $m$.



In particular, let $M$, $C$ and $K$ be random variables denoting the unknown message, ciphertext and key respectively, and let $\Pr[M = m]$ and $\Pr[M = m \mid C = c]$ respectively denote the attacker's subjective probabilities of $m$ being the correct message before and after observing the ciphertext $c$.  Then, by Bayes' law, $$\Pr[M = m \mid C = c] = \frac{\Pr[C = c \mid M = m]}{\Pr[C = c]}\, \Pr[M = m],$$ where $\Pr[C = c \mid M = m]$ is the probability of the message $m$ yielding the ciphertext $c$, and $$\Pr[C = c] = \sum_{m'} \Pr[C = c \mid M = m'] \Pr[M = m']$$ is the marginal probability of any message yielding the ciphertext $c$.

Now, by the assumptions that:


the key $k$ is uniquely determined by $m$ and $c$,
the key $k$ is independent of the message $m$, and
each key is equally likely to be chosen by the encryptor,


we have $\Pr[C = c \mid M = m] = \Pr[K = k(m,c) \mid M = m] = \Pr[K = k(m,c)] = \frac1n,$ where $n$ is the total number of possible keys &mdash; a constant independent of $m$.  Since the marginal probability $\Pr[C = c]$ is also clearly independent of $m$ (and, in fact, also equal to $\frac1n$), we find that $\Pr[M = m \mid C = c] = \Pr[M = m]$.

Thus, observing the ciphertext $c$ will not change the attacker's belief in the likelihood of a given message $m$, which is the definition of perfect secrecy.



*) Strictly speaking, the key $k$ need not actually be unique; all that's needed is that, for each $(m, c)$ pair, the number of distinct keys that encrypt $m$ to $c$ is the same.  We could also relax, or even completely eliminate, the requirement that all keys are equally likely, but then we'd have to rephrase the remaining criteria in terms of the probabilities of the sets of keys encrypting $m$ to $c$, rather than just their number, being equal.