# Public key Algorithms in Cryptography

In the previous article, we have talked about cryptography and symmetric key algorithms. So let’s dive into the Asymmetric key cryptography.

# Asymmetric Encryption

Asymmetric encryption algorithms do not use one single key to encrypt and decrypt the information like symmetric encryption. Instead of using a single key, asymmetric encryption mechanism uses 2 keys that called public and private keys. Usually, the key length is 512 to 4096 bits. The data encryption mechanism in asymmetric encryption is really slow because this algorithm is based on difficult computational algorithms.

These algorithms are also known as public-key algorithms. In this technique, the sender and the receiver do not share a secret key. Instead of using a secret key, it is using the receiver’s public key to encrypt the data. so that encrypted information can only be decrypted by the receiver’s private key which is secret to him.

Let’s explain asymmetric encryption further,

when using asymmetric encryption, both Alice and bob have to generate keypair on their computers. Keys can be securely generated by using the RSA algorithm. that algorithm will generate a public and private key that are mathematically linked to each other. Public keys can be used to encrypt data and only the matching private key can be used to decrypt it. Even though the keys are linked together, they cannot be derived from each other.

This process start by exchanging the public keys. So, Alice takes a document and encrypt it with bob’s public key. Then she sends the encrypted file to blob and he uses his private key to unlock the document and read it. Only bob is able to decrypt the message because they used asymmetric encryption.

RSA, ElGamal, elliptic curves are good examples for asymmetric encryption algorithms.

**RSA**

RSA is a public algorithm which can be used by anyone. RSA is much slower than DES in both hardware and software. RSA preserves confidentiality, authentication and non-repudiation. This algorithm is suitable for digital signing and encryption and widely used in electronic commerce protocols and secured with lengthy keys like in 512 to 2048 bits keys. In RSA signing verification is faster than the signature generation.

**DH**

It is an asymmetric algorithm founded in 1976 and also assumed that it is very safe because the time to crack this algorithm is unknown. In addition, resource consumption of DH algorithm is at a medium level. 512, 1024, 2048 bit key lengths are available. DH is for the modern and most common way of key exchange algorithm used in networks. Not used for encrypting a bulk of data because it is extremely slow just used for key exchange.

**Digital Signature Algorithm**

Key length is in 512 to 1024 range of bits. A digital signature authenticates a source that certain party has signed the data and guarantee that data has not been altered. Third parties accept these digital signatures as proof so it cannot be repudiated. Mainly there are six steps to the digital signature process. This standard uses DSA as the algorithm and public key algorithm is based on ElGamal. Speed of this algorithm is similar to RSA but slow in the verification process.