Alice encrypts the message with own private key.Sends the encrypted message to Bob.The public key is the opposite of the secret key, Bob opens the encrypted message using the public key. Message is a meaningful message when Bob opens the message, Bob understands that her message.Certificates, e-signatures
Bob can send the message by encrypting it with the public key. Alice can open the encrypted message with its own private key, Alice can read the message.
Bob encrypts the message with own private key. Bob also encrypts it with Alice’s public key.Alice decodes the encrypted message with her own private key. Because you know, her private key opposites with her public key. With Bob’s public key, she decodes the secret key in the message. Thus, the message can be read.
RSA
It was discovered in 1977 by Ron Rives, Adi Shamir and Leonard Aldeman. The name of the encryption method consists of the initials of these three names.
How does it work:
Two sufficiently large numbers: These numbers are p and q in our example.
n = p*q is calculated. It is the product of two prime numbers and accepts it as a base (modulus) for both public and reverse passwords.
The totient value is calculated. For this example, since both of the factors are prime numbers, n (n) = (p-1)*(q-1).
The calculated totient function value (φ (n)) is equal to that of a number that is equal to 1 < e < φ (n) occurs.
Keys can be declared from this budget a mode is calculated.: : d*e ≡ 1 mod ( φ(n) ). This d value is stored as the correct password. This number needs to be calculated by extended euklite (expanded euclide).
Encryption process
For encryption, Alice publishes its own public password (n, e). Receiving this password, Bob encrypts the message in the following way:
\[c=m^e mod n\]
m is the text to be encrypted, e and n is Alice’s public password
Opening the password process
Alice uses the following formula when opening the message sent by Bob:
\[m=c^d mode n\]
The encrypted text to be opened here is c, and the private password of Alice is indicated by d. n is the modulus with the base value.
For Example:
Two prime numbers are selected p = 61 and q = 53
The value of n is calculated in the form of n = pq n = 61 * 53 = 3233 Totient function is calculatedφ(n) = (p-1) (q-1)
φ(n) = (61-1) (53-1) = 3120
the totient function is the result of which the prime is selected and a number greater than 1 is selected e> 1 => e = 17 (between 3120 and prime), this number is also the public password.
To be a private password, a number d is selected: There is a d number d*e ≡ 1 mod(n), d = 2753 (because 17 * 2753 = 46801 = 1 + 15 * 3120). During the calculation of this number, extended euclide method was used.
For example:
You get 123 messages to be sent:
\({123^{17} mod 3233 = 855}\) contains encrypted text.
The opposite will be applied to the transaction:
\(855^{27} 53 mod 3233 = 123\) Obtain the original message as 123