U3 Rsa Algorithm
U3 Rsa Algorithm
RSA is the best known, and by far the most widely used general
public key encryption algorithm, and was first published by Rivest, Shamir
& Adleman of MIT in 1978 [RIVE78]. Since that time RSA has reigned
supreme as the most widely accepted and implemented general-purpose
approach to public-key encryption. The RSA scheme is a block cipher in
which the plaintext and the ciphertext are integers between 0 and n-1 for
some fixed n and typical size for n is 1024 bits (or 309 decimal digits). It is
based on exponentiation in a finite (Galois) field over integers modulo a
prime, using large integers (eg. 1024 bits). Its security is due to the cost of
factoring large numbers. RSA involves a public-key and a private-key where
the public key is known to ll and is used to encrypt data or message. The
data or message which has been encrypted using a public key can only be
decryted by using its corresponding private-k y. Each user generates a key
pair i.e. public and private key using the following steps:
each user selects two large primes at random - p, q
compute their system modulus n=p.q
calculate ø(n), where ø(n)=(p-1)(q- 1)
selecting at random the encry tion key e, where 1<e<ø(n),and gcd(e,ø(n))=1
solve following equation to find decryption key d: e.d=1 mod ø(n) and 0≤d≤n
publish their public encr ption key: KU={e,n}
keep secret private decryption key: KR={d,n}
Both the sender and receiver must know the values of n and e, and only the
receiver knows the value of d. Encryption and Decryption are done using
the following equations. To encrypt a message M the sender:
– obtains public key of recipient KU={e,n}
– computes: C=Me mod n, where 0≤M<n
To decrypt the ciphertext C the owner:
– uses their private key KR={d,n}
– computes: M=Cd mod n = (Me) d mod n = Med mod n
For this algorithm to be satisfactory, the following requirements are to be met.
a) Its possible to find values of e, d, n such that Med = M mod n for all M<n
b) It is relatively easy to calculate Me and C for all values of M < n.
c) It is impossible to determine d given e and n
AN EXAMPLE OF
RSA
can be given as, Determine d: de=1 mod 160 and d < 160 Value is d=23
Select primes: p=17 & since 23×7=161= 10×160+1
q=11 Publish public key KU={7,187}
Compute n = pq Keep secret private key KR={23,187}
=17×11=187 Now, given message M = 88 (nb. 88<187)
Compute ø(n)=(p–1)(q- encryption: C = 887 mod 187 = 11
1)=16×10=160 decryption: M = 1123 mod 187 = 88
Select e : gcd(e,160)=1;
choose e=7
Difference between Private key and Public key
Difficulty Level : Basic
Last Updated : 29 Jan, 2020
Cryptography is the science of secret writing with the intention of keeping the data secret.
Cryptography is classified into symmetric cryptography, asymmetric cryptography and
hashing.
Private Key:
In Private key, the same key (secret key) is used for encryption and decryption. In this
key is symmetric because the only key is copy or share by another party to decrypt the
cipher text. It is faster than the public key cryptography.
Public Key:
In Public key, two keys are used one key is used for encryption and another key is used
for decryption. One key (public key) is used for encrypt the plain text to convert it into
cipher text and another key (private key) is used by receiver to decrypt the cipher text to
read the message.
Now, we see the difference between them:
S.N Private Key Public Key
O
1. Private key is faster than public It is slower than private key.
key.
2. In this, the same key (secret key) In public key cryptography, two keys
and algorithm is used to encrypt are used, one key is used for
and decrypt the message. encryption and while the other is used
for decryption.
3. In private key cryptography, the In public key cryptography, one of the
key is kept as a secret. two keys is kept as a secret.
4. Private key Public key is Asymmetrical because
is Symmetrical because there is there are two types of key: private and
only one key that is called secret public key.
key.
5. In this cryptography, sender and In this cryptography, sender and
receiver need to share the same receiver does not need to share the
key. same key.
6. In this cryptography, the key is In this cryptography, public key can be
private. public and private key is private.