First, let's recall Modular Arithmetic!
RSA cryptosystem -- was developed by Ron Rivest, Adi Shamir and Leonard Adleman in 1977.
(MsgE1)E2 = (MsgE2)E1 = Msg (mod M) Msg -- Message E1 -- Exponent 1 E2 -- Exponent 2 M -- calculation Module
MsgoExp = eMsg (mod M) -- encryption with a open exponent (Public key) eMsgsExp = Msg (mod M) -- decryption with a secret exponent (Private key) eMsg -- encrypted Message M -- Modulo of the Recipient of the message
Public key encryption encrypts data sent to the owner of the corresponding private key. This function became the primary application.
MsgsExp = sMsg (mod M) -- signing with a secret exponent (Private key) sMsgoExp = Msg (mod M) -- verification with a open exponent (Public key) sMsg -- message Signature M -- Modulo of the message SenderThe encryption and decryption formulas are equivalent!
A message encrypted with one key of the pair can be decrypted with only the other key of the same pair. If a message is successfully decrypted by the public key, then it was encrypted using an only matching private key. Thus, the ciphertext obtained as a result of using the private key can be considered the digital equivalent of the signature on the decrypted document.
Use Finding Prime Numbers or . More short numbers you can get at Dumb Primality Test form.
The RSA modulus is non-secret and use for encryption and decryption. Determining the pair of numbers (A, B) that make up a modulus is extremely difficult -- Integer Factorization.
M = A × B -- Product of two prime numbers λ(M) = lcm(λ(A), λ(B)) -- Carmichael function λ(x) = φ(x) -- For prime numbers, the Carmichael function coincides with the Euler function. φ(x) = x − 1 -- The Euler function for prime numbers has a trivial definition. lcm(p, q) = |p × q| / gcd(p, q) -- Calculating the Least Common Multiple using the Greatest Common Divisor.
1 < oExp < λ(M) -- Public Key must be less than the Carmichael function. gcd(oExp, λ(M)) = 1 -- oExp and λ(M) are coprimePrime oExp ⇒ oExp and λ(n) are coprime.
The usual exponent 65537 = 216+1 = 100000000000000001(2) is a prime number. This frees us from checking the greatest common divisor for any λ.
(1) Any sender of a message encrypts it using the Public Key (Modulo and Open Exponent) of the message recipient.
(2) The message can only be decrypted using the secret exponent. Only the module's creator can calculate the secret exponent.
(1) The module owner encrypts the message using a secret key.
(2) Anyone can decrypt this message using the public key.
The ciphertext obtained using the secret key cannot be obtained in any other way. Thus, the result of the encryption operation is unique and can be interpreted as equivalent to a message signature.
Review the previous four forms. They implement four operations.
The same formula is used for all operations -- AB (mod M). Try checking your previous calculations using the following form.
Let us consider once again the operation of raising to a power by modulo.