Computer >> Computer tutorials >  >> Programming >> Programming

What are the Steps in RSA in Information Security?


The RSA algorithm is a public-key signature algorithm founded by Ron Rivest, Adi Shamir, and Leonard Adleman. RSA can also encrypt and decrypt general data to securely exchange information along with managing digital signature verification.

The RSA algorithm is based on the complexity contained in the factorization of large numbers. The RSA algorithm depends on the fact that there is no effective method to factor very large numbers. Therefore, deducing an RSA key would take a large amount of time and processing power.

RSA algorithm is asymmetric cryptography algorithm as it operate on two different keys such as public key and private key. The public key is likely to everyone, and private key remains private. The public key includes two numbers, one of which is a multiplication of two large prime numbers.

In RSA encryption, a message is encrypted with a code is known as public key, which does not required to be hidden. It is based on the mathematical properties of the RSA algorithm, because a message has been encrypted with the public key, it can only be decrypted by another key, which is known as private key. Therefore, a set of key, which are public and private keys, is needed to read such messages.

There are the following steps in RSA Algorithm which are as follows −

  • Generating the keys
    • Choose two large prime numbers, such as P and Q. The prime numbers required to be large so that they will be complex for someone to figure out.

    • Compute N = P x Q

    • Choose the public key (i.e., the Encryption key) E such that it is not a factor of (P-1) and (Q-1).

    • Choose the private key (i.e., the decryption key) D such that the following equation is true −

         (D x E) mod (P - 1) x (Q – 1) = 1

    • For encryption, compute the cipher text (CT) from the plain text (PT) as follows −

                             CT = PTE mod N

    • Send CT as the cipher text to the receiver.

    • For encryption, compute the plain text (PT) from the cipher text (CT) as follows −

                               PT = CTD mod N

  • Encryption/Decryption Function − Once it can generate the keys, and it can pass the parameters to the functions that calculate the ciphertext and plaintext using the respective key.

    • If the plaintext is m, ciphertext = me mod n.

    • If the ciphertext is c, plaintext = cd mod n

  • For example, where p = 17 and q=13. Value of e can be 5 as it satisfies the condition 1 < e < (p-1) (q-1).

    N = p * q = 91

    D = e-1 mod (p-1) (q-1) = 29

    Public Key pair = (91, 5)

    Private Key pair = (91, 29)

    If the plaintext (m) value is 10, it can encode it utilizing the formula me mod n = 82.

    To decrypt this ciphertext(c) back to original data, it should use the formula cd mod n = 29.