Public Key Algorithms in Cryptography

Mahesha Muthumala
2 min readJul 29, 2020

Public key algorithms are also known as Asymmetric Key Algorithms.

Each party that combines with asymmetric key algorithms has pair of keys as public key and private key.

Public key: may be known by anyone who asks for it and enables people to encrypt message and verify signatures.

Private key: remains private and cannot be given out. Private key decrypts the message and generates the signature.

Asymmetric key algorithms are not quite as fast as symmetric key algorithms. This is partially due to the fact that asymmetric key algorithms are generally more complex, using a more sophisticated set of functions.

Examples for widely used asymmetric key algorithms are Diffie-Hellman algorithm and RSA.

Diffie-Hellman Algorithm

The first publicly disclosed public key algorithm was the Diffie-Hellman algorithm.

Diffie-Hellman algorithm is used to establish a secure communication channel between the sender and the receiver. This channel is used by the systems to exchange a private key. This private key is then used to do symmetric encryption between the two systems.

For example, when A and B wish to exchange some key over an insecure communication channel,

Initially, A and B select,

a large prime integer — p

a primitive root — a

a secret key — XA , XB

Then A and B compute their public keys YA and YB as shown below.

After sharing the public keys, the key KAB can be calculated separately by A and B as shown below.

Then KAB is used as a session key in a private key cipher to secure communications between A and B.

RSA

Rivest Shamir Adelman algorithm (RSA) is an elegantly simple algorithm with some extremely complex math behind it.

RSA consists of a function that utilizes some unique properties of large prime numbers and modular mathematics.

RSA supports key lengths of 768 and 1024 bits.

The RSA algorithm uses a three part process.

  1. The first part is key generation using mathematical operations based on prime numbers.
  2. The second part of the process is encryption. Encryption is done using one of the keys in the key pair.
  3. The third part of the process is decryption. Decryption is done using the other key in the key pair.

RSA is an extremely useful algorithm that is employed in thousands of applications.

--

--

Mahesha Muthumala

Software Engineering Undergraduate | University of Kelaniya, Sri Lanka.