Trusted answers to developer questions

What are symmetric and asymmetric cryptosystems?

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

Cryptography ensures secure end-to-end communication by using encryption. Implementation of various cryptographic techniques to provide information security is called a cryptosystem. The main components of a cryptosystem are as follows:

  • Plaintext: It is the input message that needs to be encrypted.

  • Encryption key: The sender of the plaintext requires this key for encryption.

  • Encryption algorithm: This cryptographic algorithm takes the plaintext and the encryption key as input to output the encrypted message.

  • Ciphertext: It is the encrypted message output.

  • Decryption key: The receiver requires this key for decryption.

  • Decryption algorithm: This is a cryptographic algorithm that reverses the encryption. It takes the ciphertext and decryption key as input and outputs the plaintext.

Types of cryptosystems

Based on the differences in encryption and decryption, we can categorize the cryptosystems into the following two types:

  • Symmetric Cryptosystem

  • Asymmetric Cryptosystem

The fundamental difference between them is that the symmetric cryptosystem only involves one key that the system uses for encryption and decryption. The asymmetric cryptosystem uses two keys (private and public) for encryption and decryption.

Symmetric cryptosystem

Since the symmetric cryptosystem uses the same key for encryption and decryption, the sender and receiver need to know the key before exchanging messages. For this, the system employs key exchange protocols (like the Diffie-Hellman Protocol) to ensure that the sender and receiver agree on the secret key before starting the communication. The illustration below depicts symmetric encryption and decryption using the same key:

Symmetric Cryptosystem

For the encryption algorithms, the symmetric cryptosystem uses AES-128, AES-192, and AES-256. The encryption process is generally faster in symmetric cryptosystems due to the smaller key lengths. The drawback of this system is that the senders and receivers need to exchange keys before decrypting the message. If the keys are not changed regularly, the system will be prone to attacks since an attacker can use the leaked key to disrupt the communication. The symmetric cryptosystem uses MACs to provide integrity and authentication.

Asymmetric cryptosystem

The asymmetric cryptosystem overcomes the symmetric cryptosystem challenges by eliminating the need to pre-sharing the key before communication. The asymmetric cryptosystem used two keys (private and public) that are mathematically related to each other. The strength of security lies in these keys’ properties since it is computationally infeasible to calculate one key using the other. Each sender and receiver will have their private-public key pair in this system. Suppose A wants to send a message to B, A will need to use B’s public key to encrypt the message, and B will decrypt the message using their private key. The illustration below depicts asymmetric encryption and decryption using two keys:

Asymmetric cryptosystem

For the encryption algorithms, the asymmetric cryptosystem uses El Gamal Encryption or RSA Encryption schemes. The encryption process is slower than symmetric encryption due to larger key sizes. The asymmetric cryptosystem is more secure since the private and public key pairs are less likely to get leaked and predicted. The asymmetric cryptosystem uses RSA signatures to provide integrity and authentication.

RELATED TAGS

cryptosystems
symmetric
asymmetric
encryption

CONTRIBUTOR

Umme Ammara
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?