I am learning RSA cryptography. The part I am stuck on is understanding how k and the public exponent $e$ is selected.
Given the formulas;
Decrypting: $c^d \bmod N = (m^e)^d \bmod N$ Which is equal to m the message
Encrypting: $m^e \bmod N = c$
My question is when generating the private exponent how do we find what the public exponent should be and what k should be in the formula
$$d = (1 + k*\varphi(N))/e$$
I understand it has something to do with the inverse of modules but I don t get the math behind it.