cns3 1
cns3 1
cns3 1
public-key cryptography is asymmetric, involving the use of two separate keys, in contrast to
symmetric encryption, which uses only one key. The use of two keys has profound
consequences in the areas of confidentiality, key distribution, and authentication, as we shall
see.
2. One such misconception is that public-key encryption is more secure from cryptanalysis than
is symmetric encryption. In fact, the security of any encryption scheme depends on the
length of the key and the computational work involved in breaking a cipher. There is nothing
in principle about either symmetric or public-key encryption
3. Asymmetric Keys: Two related keys, a public key and a private key, that are used to perform
complementary operations, such as encryption and decryption or signature generation and
signature verification.
4. Public Key Certificate :A digital document issued and digitally signed by the private key of a
Certification Authority that binds the name of a subscriber to a public key. The certificate
indicates that the subscriber identified in the certificate has sole control and access to the
corresponding private key.
(1) that two communicants already share a key, which somehow has been distributed to them;
or (2) the use of a key distribution center.
Asymmetric algorithms rely on one key for encryption and a different but related key for
decryption. These algorithms have the following important characteristic.
■ It is computationally infeasible to determine the decryption key given only knowledge of the
cryptographic algorithm and the encryption key
1. Plaintext: This is the readable message or data that is fed into the algorithm as input.
2. Encryption algorithm: The encryption algorithm performs various transformations on the
plaintext.
3. Public and private keys: This is a pair of keys that have been selected so that if one is used
for encryption, the other is used for decryption. The exact transformations performed by the
algorithm depend on the public or private key that is provided as input.
4. Cipher text: This is the encrypted message produced as output. It depends on the plaintext
and the key.
5. Decryption algorithm: This algorithm accepts the cipher text and the matching key and
produces the original plaintext
2. Difference between conventional encryption and public key encryption?
It is,possible to provide both the authentication function and confidentiality by a double use of the
public-key scheme.
In this case, we begin as before by encrypting a message, using the sender’s private key. This
provides the digital signature. Next, we encrypt again, using the receiver’s public key. The final
cipher text can be decrypted only by the intended receiver, who alone has the matching private key.
Thus, confidentiality is provided. The disadvantage of this approach is that the public-key algorithm,
which is complex.
Applications of public key cryptography:
three categories:
Encryption/decryption: The sender encrypts a message with the recipient’s public key, and the
recipient decrypts the message with the recipient’s private key.
Digital signature: The sender “signs” a message with its private key. Signing is achieved by a
cryptographic algorithm applied to the message .
Key exchange: Two sides cooperate to exchange a session key, which is a secret key for symmetric
encryption generated for use for a particular transaction (or session) and valid for a short period of
time.
Requirements:
1. It is computationally easy for a party B to generate a key pair (public key PUb, private key
PRb).
2. It is computationally easy for a sender A, knowing the public key and the message to be
encrypted, M, to generate the corresponding cipher text:
C = E(PUb, M)
3. It is computationally easy for the receiver B to decrypt the resulting cipher text using the
private key to recover the original message:
M = D(PRb, C) = D[PRb, E(PUb, M)]
4. It is computationally infeasible for an adversary, knowing the public key, PUb, to determine
the private key, PRb.
5. It is computationally infeasible for an adversary, knowing the public key, PUb, and a
ciphertext, C, to recover the original message, M.
Rivest-Shamir-Adleman (RSA) Algorithm:
The RSA algorithm is a public-key signature algorithm developed by Ron Rivest, Adi Shamir, and
Leonard Adleman. Their paper was first published in 1977, and the algorithm uses logarithmic
functions to keep the working complex.
There are two broad components when it comes to RSA cryptography, they are:
Key Generation: Generating the keys to be used for encrypting and decrypting the data to be
exchanged.
Encryption/Decryption Function: The steps that need to be run when scrambling and
recovering the data.
Steps:
Key generation:
Calculate d = e-1mod(p-1)(q-1)
Once you generate the keys, you pass the parameters to the functions that calculate your ciphertext
and plaintext using the respective key.
To understand the above steps better, you can take an example where p = 3 and q=11. Value of e
can be 3 as it satisfies the condition 1 < e < (p-1)(q-1).
N = p * q =33
d e mod(p-1)(q-1)=1
7*3 mod(20)=1
Advantages:
It was developed and published in 1976 by Martin Hellman and Whitefield Diffie.
Assume the private key for the receiver to be Xb where Xb < q. The public key for the
receiver is calculated as Yb = αxb mod q. For the receiver, the key pair becomes {Xb, Yb}.
Step 3: To generate the final secret key, you use three parameters. For the sender, you need
the private key (Xa), the receiver’s public key (Yb), and the original q. The formula to
calculate the key is K = (Yb)Xa mod q.
For the receiver, you need the private key (Ya), sender’s public key (Xb), and the original q.
The formula to calculate the secret key is K = (Ya)Xb mod q.
If both the values of K generated are equal, the Diffie-Hellman key exchange algorithm is
complete.
Example:
1. Key exchange is based on the use of the prime number q = 353
2. a primitive root of 353, in this case a = 3.
3. A and B select private keys XA = 97 and XB = 233, respectively.
4. Each computes its public key: A computes YA = 397 mod 353 = 40.
5. B computes YB = 3233 mod 353 = 248.
6. After they exchange public keys, each can compute the common secret key:
7. A computes K = (YB) XA mod 353 = 24897 mod 353 = 160.
8. B computes K = (YA) XB mod 353 = 40233 mod 353 = 160.
Man-in-the-middle Attack:
Suppose Alice and Bob wish to exchange keys, and Darth is the adversary. The attack proceeds as
follows
1. Darth prepares for the attack by generating two random private keys XD1 and XD2 and then
computing the corresponding public keys YD1 and YD2.
2. Alice transmits YA to Bob.
3. Darth intercepts YA and transmits YD1 to Bob.
Darth also calculates K2 = (YA) XD2 mod q.
4. Bob receives YD1 and calculates K1 = (YD1) XB mod q.
5. Bob transmits YB to Alice.
6. Darth intercepts YB and transmits YD2 to Alice.
Darth calculates K1 = (YB) XD1 mod q.
7. Alice receives YD2 and calculates K2 = (YD2) XA mod q.
At this point, Bob and Alice think that they share a secret key, but instead Bob and Darth share
secret key K1 and Alice and Darth share secret key K2.
The Elgamal Cryptosystem: