It is called as asymmetric encryption technique because it handles two keys in number for encryption and decryption process. It offers the services which are provided by the symmetric encryption but in addition to that it also offers digital signature and key distribution methodologies. Anyone having the public key can encrypt messages or verify signatures, but cannot decrypt messages or create signatures. But the one who is having the private key can decrypt and create the signatures. It is also said to be asymmetric because those who encrypt the message and create the signature cannot decrypt and verifies the signature. 

Characteristics of public key cryptography: 

  • It is computationally infeasible to find the decryption key when knowing the encryption algorithm and the decryption key. 
  • It is also computationally feasible to find the encrypted/decrypted messages when the relevant encrypted/decrypted key is known. 
  • It uses either of the two keys for encryption and other for decryption process. 

Block representation of public key cryptography: 

The above picture represents the encryption using public key. 

The above picture represents the encryption using public key. 

So what is the difference between symmetric and asymmetric encryption: 

It uses same key for the encryption and decryption and with the same algorithm  It uses different keys for encryption and decryption and with the same algorithm
The sender and the receiver must share the key and the algorithm.  The sender and receiver must have one among the two keys with them but not the same. 
The key must be kept secret One of the two keys must be kept secret

Public key cryptography provides authentication and secrecy. 

Depending on the application, the sender makes the usage of sender’s private key or receivers public key or both for the better performance of some of the cryptographic functions. 

In this mechanism the encryption always starts with the receiver and. The receiver generates two pair of keys one is public another is private. Public is shared with the sender and the encryption is done. The receiver uses his private key to decrypt the message. 

Public key cryptographic applications: 

  • Digital signatures. 
  • Key exchange 

Digital signatures: 

This is one of the most prominent applications of the public key cryptography. In this the sender signs the message with its private key; it may applicable to the whole, message or to some certain block of the message. 

Key exchange: 

The server and the client co-operates for exchanging the session keys over the communication channel. 

Security services offered by the digital signatures: 


The public key mechanism provides authentication in a way that the signature is signed by the individual’s private key. So that recipient was confident enough that sender was the one to apply the signature. 


The public key cryptography mechanism provides non-repudiation service in a way that the individual cannot blame others by saying it was not his signature because he was the only person who was given access to the private key. 


When the signature is verified at the senders end, it checks for the content in the message and maintains the time stamp of the signature, the slight change in the document makes the process check to fail. 

Examples where protocols using public key cryptography techniques: 

  • SSH 
  • Bitcoin 
  • Internet key change 
  • Secure socket layer 
  • Transport layer security 
  • VoIP protocol 

Algorithms which uses public key mechanism: 

  • RSA 
  • RSA: 

It is one of the algorithm which follows asymmetric encryption methodology. The main theme of this encryption algorithm is using the method of prime factorization. Prime factorization involves finding the factors of the large composite prime number. This uses of the product of two prime numbers, which in turn makes the cryptanalyst in a problem of finding the actual numbers. In this each user generates a pair of public/private keys. 

Working of RSA: 


Select two prime numbers, say P,Q and P≠Q. 


Calculating the system modules, 


[Symbol](n)= (P-1) (Q-1) 


Select the random number which is said to be the encryption key. Say e 

1<e< [Symbol](n) and gcd ([Symbol](n), e) =1 


Find the decryption key d. 

e.d[Symbol] 1mod [Symbol](n) 


Publish the public key for encryption 

PU= {e, n} 


Keep the secret private key for decryption 

PR= {d, p, q} 

Encryption: C= Me mod n 

Decryption: M= Cd mod n 

Say p=3,Q=11;e=7;r=5

first we have to find n



given e=7;


check weather condition is satisfyinf for e on not

finding the d cryption key d.




public key={7,33}

private key={3,3,11}


C=Me mod n

C=5 mod 33

   =78125 mod 33



C=Cd mod n

C=14 mod 33

   =2744 mod 33


M should be < N

RSA security: 

The ways in which attacking can be possible in RSA  

  • Brute force attack 
  • Mathematical attack 
  • Timing attack. 


ECC is also an algorithm based on the asymmetric encryption. It is used to create faster, smaller and efficient keys. It follows elliptical equation to generate the keys unlike the traditional method of prime numbers. It can also be combined with the RSA and diffie-hellman key exchange. 

The general notation is  Y3=x3+ax+b 

Combination of ECC with elgamal: 

Key exchange algorithm: 


it is the key exchange algorithm where the cryptographic key is exchanged over the public class. It is not used for any encryption or decryption of the messages. 



Select prime number q, 

An integer α that is primitive root of q. 


User A selects the random integer  XA<q. and computes  

YA= αXA mod q 


User B selects the random integer XB<q. and computes. 

XB= αXB mod q 


Both sides keeps the X as secret key and Y as public key, user A computes secret key as 

K= YB XA mod q. 

User B computes secret key as  

K=YA XB md q 

Primitive root: 

Primitive root of a prime number n is an integer r between [1,n-1] such that values of             rx mod n where x is in range of [0,n-2] are different. 



10 mod 7=1 

11 mod 7=1 

12 mod 7=1 

13 mod 7=1 

14 mod 7=1 

15 mod 7=1 

Value are repeated, go for r=2, 

20 mod 7=1 

21 mod 7=2 

22 mod 7=4 

23 mod 7=1 

24 mod 7=2 

25 mod 7=4 

Values are repeated, go for r=3, 

30 mod 7=1 

31 mod 7=3 

32 mod 7=2 

33 mod 7=6 

34 mod 7=4 

35 mod 7=5 

Values are not repeated so primitive values for 7 are 3. 

Example of diffie-hellman: 

q=23; \propto = 9

sender and receiver computes public value.

YA=9mod 23 = 6561 mod 23 = 6

YB=93mod 23 = 729 mod 23 = 16

sender and receiver excange public keys.

KA=(YB)XA mod q = 164 mod 23 = 9

KB=(YB)XB mod q = 63 mod 23 = 9

KA=KB ; sender and receiver can talk security

Elgamal cryptographic system: 

It is same as diffie-hellman key exchange but also provides the encryption and decryption mechanism. It is also a asymmetric encryption which also provides add-ons when compared with the diffie-hellaman key exchange. 



Select prime number q, 

An integer α that is primitive root of q. 


User A selects the random integer  XA<q. and computes  

YA= αXA mod q 


Key distribution. 

Private Key: {XA} 

Public key: {q, , XA} 



M<q; K<q 

K= YA k mod q 

C1= αK mod q 

C2= K*M mod q 



K= c1 XA mod q 

M= c2*k-1 mod q 


q=71;  \propto = 7; k=2; M=30; YB=3

According to the above given q values

we have to selet XA



YA=\proptoYAmod q

     =(7)2mod q


private key={49}

public key={71,7,49}

given k=2

K=(49)2mod 71

     =2401mod 71


C1=\proptoK mod q

C1=(7)2mod 71=49

C1= KM mod 71=36


Most prominent attack possible in public key cryptography and the diffie-hellman key exchange is MAN IN THE MIDDLE attack. 

In this process of attacking the foreigner prepares for the attack by generating two random private keys, XD1 and XD2. Computing public keys YD1 and YD2. On the parallel hand, sender sends YA to receiver.  Foreigner intercepts YA and transmits YD1 to receiver. Foreigner also calculates K2=YA XD1 mod q. receiver receives YD1 and calculates K1=YD1 XB md q. receiver transmits YB to sender. Foreigner intercepts YB and transmits YD2 to receiver. Foreigner also calculates K=YB XD1 md q. sender receives YD2 and calculate K2=YD2 XA md q.