# What are the steps of key generation using RSA algorithm?

RSA is a cryptosystem for public-key encryption, and is broadly used for securing responsive information, specifically when being sent over an insecure network including the Internet.

In RSA cryptography, both the public and the private keys can encrypt a message; the inverse key from the one used to encrypt a message is used to decrypt it. This attribute is one reason why RSA has develop into the most broadly used asymmetric algorithm. It supports an approach of assuring the confidentiality, integrity, authenticity and non-reputability of digital connection and data storage.

RSA need a multiplicative group G =< Z$\mathrm{\phi}$n,*, X > for key generation. This group provides only multiplication and divisions, which are required for generation of public and private keys. This group is secret from the public because its modulus, $\mathrm{\phi}$(n) is hidden from the public.

The public and the private key-generation algorithm is the most difficult element of RSA cryptography. There are two large prime numbers, p and q, are produced using the Rabin-Miller primarily test algorithm.

A modulus n is computed by multiplying p and q. This number can be used by both the public and private keys and supports the connection between them. Its length, generally defined in bits, is known as key length.

The public key includes the modulus n, and a public exponent, e, which is usually set at 65537, as it's a prime number that is not too big. The e figure doesn’t have to be a privately chosen prime number as the public key is shared with everyone.

The private key includes the modulus n and the private exponent d, which is computed using the Extended Euclidean algorithm to discover the multiplicative inverse regarding the totient of n.

Considering arithmetic modulo n, let us say that e is an integer that is co-prime to the totient $\mathrm{\phi}$(n) of n. Moreover, it can say that d is the multiplicative inverse of e modulo $\mathrm{\phi}$ (n). These definitions of the several symbols are listed below for convenience:

n = a modulus for modular arithmetic

$\mathrm{\phi}$ (n) = the totient of n

e = an integer that is associatively prime to $\mathrm{\phi}$(n)

[T his guarantees that e will possess a multiplicative inverse modulo $\mathrm{\phi}$(n)]

d = an integer that is the multiplicative inverse of e modulo $\mathrm{\phi}$(n)

The computational steps for key generation are

• Generate two different primes including p and q.

• Compute the modulus n = p × q

• Compute the totient $\mathrm{\phi}$(n) = (p − 1) × (q − 1)

• Select for public exponent an integer e such that 1 < e <$\mathrm{\phi}$(n) and gcd($\mathrm{\phi}$(n), e) = 1.

• Compute for the private exponent a value for d such that d = e−1 mod $\mathrm{\phi}$(n)

• Public Key = [e, n]

• Private Key = [d, n]