# RSA algorithm Possible application of the [Primality Test](03.Primality%20Test.md) is used in public-key [cryptosystems](../../Computer%20Security/src/02.Foundations%20of%20Cryptography.md) for example, which is commonly used for secure data transmission. The idea of asymettric encryption is: 1. $P$ (public key) and $S$ (secret key) can be computed efficiently 2. With a $P$ , $S$ : 3. $S$ is not computable from $P$ (without a quantum computer, during the life of this universe) RSA algorithm steps (simplified, toy example): 1. randomly select two primes $p$ and $q$ of similar size, each with $l+1$ bits ( $l \ge 500$) 2. let $n=p \cdot q$ 3. let $e$ an integer co-prime with $(p-1)(q-1)$ 4. $d= (\frac{1}{e})mod ((p-1)(q-1))$ 5. $P=(e,n)$ and $S=(d,n)$ 6. let $M=\text{message} , C=M^e \space mod (n) \rightarrow M=C^d \space mod (n)$