Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

Asymmetric key

• Asymmetric encryption uses a mathematically related pair of keys for


encryption and decryption: a public key and a private key.
• the public key is used for encryption, then the related private key is used for
decryption.
• If the private key is used for encryption, then the related public key is used
for decryption.
• The two participants in the asymmetric encryption workflow are the
sender and the receiver.
• Each has its own pair of public and private keys.
• First, the sender obtains the receiver's public key.
• Next, the plaintext message is encrypted by the sender using the
receiver's public key. This creates ciphertext. The ciphertext is sent
to the receiver, who decrypts it with their private key, returning it to
legible plaintext.
• Because of the one-way nature of the encryption function, one
sender is unable to read the messages of another sender, even
though each has the public key of the receiver.
• Uses of asymmetric cryptography
• Asymmetric cryptography is typically used to authenticate data
using digital signatures.
• A digital signature is a mathematical technique used to validate
the authenticity and integrity of a message, software or digital
document. It is the digital equivalent of a handwritten signature or
stamped seal.
• Based on asymmetric cryptography, 
digital signatures can provide assurances of evidence to the
origin, identity and status of an electronic document, transaction
or message, as well as acknowledge informed consent by the
signer.
• Asymmetric cryptography can also be applied to systems in
which many users may need to encrypt and decrypt messages,
including:
• Encrypted email. A public key can be used to encrypt a
message and a private key can be used to decrypt it.
• SSL/TLS. Establishing encrypted links between websites and
browsers also makes use of asymmetric encryption.
• Cryptocurrencies. Bitcoin and other cryptocurrencies 
rely on asymmetric cryptography. Users have public keys that
everyone can see and private keys that are kept secret. Bitcoin
uses a cryptographic algorithm to ensure only legitimate owners
can spend the funds.
What are the benefits and disadvantages of asymmetric
cryptography?
• The benefits of asymmetric cryptography include:
• The key distribution problem is eliminated because there's no
need for exchanging keys.
• Security is increased since the private keys don't ever have to
be transmitted or revealed to anyone.
• The use of digital signatures is enabled so that a recipient can
verify that a message comes from a particular sender.
• It allows for nonrepudiation so the sender can't deny sending a
message.
Disadvantages of asymmetric cryptography include:

• It's a slow process compared to symmetric cryptography.


Therefore, it's not appropriate for decrypting bulk messages.
• If an individual loses his private key, he can't decrypt the
messages he receives.
• Because public keys aren't authenticated, no one can ensure a
public key belongs to the person specified. Consequently, users
must verify that their public keys belong to them.
• If a malicious actor identifies a person's private key, the attacker
can read that individual's messages.
Math in cryptography:
Finding modulus:
1%3= 1
2%3= 2
3%3=0
3%4=3
4%3=1
5%3=2
6%3=????
7%3=????
3%7=????
Prime number:
• A whole number greater than 1 that cannot be exactly divided by any
whole number other than itself and 1 (e.g. 2, 3, 5, 7, 11).
• "prime numbers are very useful in cryptography"
What is co-prime numbers with examples?
• For example, 2 and 3 are two prime numbers.
• Factors of 2 are 1, 2, and factors of 3 are 1, 3. The only common factor is
1 and hence they are co-prime. 
• Any two successive numbers/ integers are always co-prime: Take any
consecutive numbers such as 2, 3, or 3, 4 or 5, 6, and so on; they have 1
as their HCF.
RSA Algorithm
• The RSA algorithm -- the most widely used asymmetric algorithm -- is
embedded in the SSL/TLS, which is used to provide secure
communications over a computer network. RSA derives its security from
the computational difficulty of factoring large integers that are the product
of two large prime numbers.
• Multiplying two large primes is easy, but the difficulty of determining the
original numbers from the product -- factoring -- forms the basis of public-
key cryptography security. The time it takes to factor the product of two
sufficiently large primes is beyond the capabilities of most attackers.
• RSA keys are typically 1024 or 2048 bits long, but experts believe 1024-
bit keys will be broken soon, which is why government and industry are
moving to a minimum key length of 2048-bits.
RSA algorithm is an asymmetric cryptography algorithm.
Asymmetric actually means that it works on two different keys i.e. Public Key
and Private Key.
As the name describes that the Public Key is given to everyone and the Private
key is kept private.
The idea of RSA is based on the fact that it is difficult to factorize a large integer.
The public key consists of two numbers where one number is a multiplication of
two large prime numbers.
The private key is also derived from the same two prime numbers.
So if somebody can factorize the large number, the private key is compromised.
Therefore encryption strength totally lies on the key size and if we double or
triple the key size, the strength of encryption increases exponentially. RSA keys
can be typically 1024 or 2048 bits long, but experts believe that 1024-bit keys
could be broken in the near future. But till now it seems to be an infeasible task.
RSA Encryption and Decryption
• The data to be sent is encrypted by sender A using the public key of
the intended receiver
• B decrypts the received ciphertext using its private key, which is
known only to B. B replies to A encrypting its message using A's public
key.
• A decrypts the received ciphertext using its private key, which is
known only to him
RSA encryption algorithm:
• RSA is the most common public-key algorithm, named after its
inventors Rivest, Shamir, and Adelman (RSA).
RSA algorithm uses the following procedure to generate public and private
keys:
• Select two large prime numbers, p and q.
• Multiply these numbers to find n = p x q, where n is called the modulus for
encryption and decryption.
• Choose a number e less than n, such that n is relatively prime to (p - 1) x (q -
1). It means that e and (p - 1) x (q - 1) have no common factor except 1.
Choose "e" such that 1<e < φ (n), e is prime to φ (n),
gcd (e,d(n)) =1
• If n = p x q, then the public key is <e, n>. A plaintext message m is encrypted
using public key <e, n>. To find cipher text from the plain text following
formula is used to get cipher text C.
C = me mod n
Here, m must be less than n. A larger message (>n) is treated as a
concatenation of messages, each of which is encrypted separately.
• To determine the private key, we use the following formula to
calculate the d such that:
De mod {(p - 1) x (q - 1)} = 1
Or
De mod φ (n) = 1
• The private key is <d, n>. A cipher
• The text message c is decrypted using private key <d, n>. To calculate
plain text m from the ciphertext c following formula is used to get
plain text m.
m = cd mod n
Let's take some example of RSA encryption algorithm:
• Choose p = 3 and q = 11
• Compute n = p * q = 3 * 11 = 33
• Compute φ(n) = (p - 1) * (q - 1) = 2 * 10 = 20
• Choose e such that 1 < e < φ(n) and e and φ (n) are coprime. Let e = 7
• Compute a value for d such that (d * e) % φ(n) = 1.
• d*7 % 20 = ???
• One solution is d = 3 [(3 * 7) % 20 = 1]
• Public key is (e, n) => (7, 33)
• Private key is (d, n) => (3, 33)
• The encryption of m = 2 is c = 27 % 33 = 29
• The decryption of c = 29 is m = 293 % 33 = 2
Example 2:
This example shows how we can encrypt plaintext 9 using the RSA
public-key encryption algorithm. This example uses prime numbers 7
and 11 to generate the public and private keys.
Explanation:
• Step 1: Select two large prime numbers, p, and q.
p=7
q = 11
• Step 2: Multiply these numbers to find n = p x q, where n is called the
modulus for encryption and decryption.
n=pxq
n = 7 x 11
n = 77
• Step 3: Choose a number e less that n.  e and (p - 1) x (q - 1) have no
common factor except 1. Choose "e" such that 1<e < φ (n), e is prime
to φ (n), gcd (e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (7 - 1) x (11 - 1)
φ (n) = 6 x 10
φ (n) = 60
Let us now choose relative prime e of 60 as 7
Thus the public key is <e, n> = (7, 77)
• Step 4: A plaintext message m is encrypted using public key <e, n>. To find cipher
text from the plain text following formula is used to get cipher text C.
To find cipher text from the plain text following formula is used to get cipher text C.
C = me mod n
C = 97 mod 77
4782969 mod 77
C = 37
• Step 5: The private key is <d, n>. To determine the private key, we use the following
formula d such that:
De mod {(p - 1) x (q - 1)} = 1
7d mod 60 = 1, which gives d = 43
7*43 mod 60=1
301 mod = 1
The private key is <d, n> = (43, 77)
Step 6: A cipher text message c is decrypted using private key <d, n>. To
calculate plain text m from the cipher text c following formula is used
to get plain text m.
m = cd mod n
m = 3743 mod 77
m=9
In this example, Plain text = 9 and the cipher text = 37
Example 2:
• In an RSA cryptosystem, a particular A uses two prime numbers, 13 and 17, to
generate the public and private keys. If the public of A is 35. Then the private key
of A is ……………?.
Explanation:
• Step 1: in the first step, select two large prime numbers, p and q.
p = 13
q = 17
• Step 2: Multiply these numbers to find n = p x q, where n is called the modulus for
encryption and decryption.
First, we calculate
n=pxq
n = 13 x 17
n = 221
• Step 3: Choose a number e less that n, such that n is relatively prime
to (p - 1) x (q -1). It means that e and (p - 1) x (q - 1) have no common
factor except 1. Choose "e" such that 1<e < φ (n), e is prime to φ (n), gcd
(e, d (n)) =1.
Second, we calculate
φ (n) = (p - 1) x (q-1)
φ (n) = (13 - 1) x (17 - 1)
φ (n) = 12 x 16
φ (n) = 192
g.c.d (35, 192) = 1
d = (1 + k.φ (n))/e           [let k =0, 1, 2, 3………………]
Put k = 0
d = (1 + 0 x 192)/35
d = 1/35
Put k = 1
d = (1 + 1 x 192)/35
d = 193/35
Put k = 2
d = (1 + 2 x 192)/35
d = 385/35
d = 11
The private key is <d, n> = (11, 221)
Hence, private key i.e. d = 11
How to break RSA

• First we have to find p and q.


• Solve the equation to find the d.

Why it is difficult to decrypt RSA????


• Factoring huge number to prime number takes a lot of
computational time.
• Then there can be number of multiples of N, so might be guessing on
wrong number.

You might also like