Blog_Banner_Asset
    Homebreadcumb forward arrow iconBlogbreadcumb forward arrow iconCyber Securitybreadcumb forward arrow iconWhat is Public Key Cryptography? Everything to know in Details.

What is Public Key Cryptography? Everything to know in Details.

Last updated:
2nd Aug, 2022
Views
Read Time
6 Mins
share image icon
In this article
Chevron in toc
View All
What is Public Key Cryptography? Everything to know in Details.

Data is essential to everyone connecting across the Internet. Every information put on or through the Internet is at risk of being exposed. Conglomerates and individuals use certain measures to protect their data and secure it during transmission over the Internet. Techniques like TCP/IP, Data Encryption, Hashing, and Cryptography are used daily to protect quintillions of data transmitted over the Internet.

Cryptography protects the data being transmitted over the Internet by changing the data format so that an unauthorised user cannot access it. Symmetric and Asymmetric Cryptography are the two types of cryptography techniques. Symmetric Cryptography is one where only a single secret key is used to encrypt and decrypt the transferred data. Asymmetric Cryptography is one where there is a pair of keys, one is used to encrypt the data whilst the other one is used to decrypt it. The pair contains a public and private key.

Learn Software Development Courses online from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.

Explore our Popular Software Engineering Courses

This article consists of the fundamentals of a public key in cryptography.

Ads of upGrad blog

Definition of Cryptography in Data Security

Cryptography is the study of techniques used to transfer data over the internet by encryption and decryption to keep it safe from unauthorised users. Cryptography mainly uses algorithms in order to perform encryption and decryption such as Triple Data Encryption Standard(a.k.a 3DES – Symmetric cryptography) or Digital Signature Algorithm(a.ka.DSA – Asymmetric Cryptography).

The roots of cryptography go back to the times of the Roman General, Julius Caesar. The Caesar Cipher is one of the simplest techniques in Cryptography. Once performed on a plaintext(representing the unprotected data), the encryption process phase shifts the character by ‘n’, making it a ciphertext(representing the encrypted data) which can again be converted into a plaintext via phase shifting the ciphertext by ‘n’ during the decryption process.

Here is an example of Caesar Cipher:

Let ‘P’ represent the plaintext and ‘C’ represent the ciphertext.

P = HI  EVERYONE

C = KL HYHUBRQH


Plaintext :     A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z

Ciphertext:   D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T   U  V  W  X  Y  Z  A  B  C

 

C = (P + 3) mod 26

P = (C – 3) mod 26

What does a ‘key’ stand for in Cryptography?

Similar to a physical key that is used in the real world to lock a door, a key in cryptography represents a set of characters that is used to lock(encrypt) data being transferred over the Internet. This same key can be used to unlock(decrypt) the data. Note that the same key is only used for decryption in the case of Symmetric Cryptography algorithms. In an Asymmetric Cryptography algorithm, a pair of keys is used for the encryption/decryption process – public key and private key. Both of these keys are related to each other mathematically. 

How does Public Key Cryptography work?

To safeguard data from unwanted access or use, public-key cryptography utilises a pair of keys to encrypt and decode it. Certification authorities provide public and private key pairs to the users over a network. Other users can encrypt data by obtaining the intended receiver’s public key from a directory available to the public. This public key encryption technique is used before transmitting the message to the intended receiver. When the communication is delivered, the receiver decrypts it with a private key that no one else possesses.

Advantages of Public Key Cryptography over Symmetric Cryptography

Public Key Cryptography is still one of the safest ways to transfer data over the internet. Below are the advantages of Public Key Cryptography over Symmetric Cryptography:

  • The fundamental benefit of public-key encryption is enhanced security: private keys are never sent or exposed to anybody.
  • It can generate digital signatures that cannot be revoked so that no party can deny the information received by them. This is known as non-repudiation that prevents the party from altering the data being transferred to them.

Most used Algorithm in Public Key Cryptography

The most widely used public-key cryptography algorithm is RSA, standing for the names of its inventors, Ron Rivest – Adi Shamir – Leonard Adleman. Though with the increased security provided with the extra bits in the RSA – 4096, it is relatively slower than RSA – 2048, so companies choose to opt for the latter. 

Let us generate our own key pairs with the help of our command-line shell having OpenSSL.

Command-line codes:

$openssl genrsa -out private.pem 2048

// This will generate a pair of keys and will be a 2048-bit RSA key pair

$ openssl rsa -in private.pem -pubout -out public.pem

// For a given private key the code above will derive the public key into ‘public.pem’

// This private and public key pair can now be used to encrypt a file with the RSA-2048 algorithm

Read our Popular Articles related to Software Development

Conclusion

Ads of upGrad blog

The classic encryption approach is based on a single secret key cryptography(Symmetric Cryptography). However, because a single secret key encrypts and decrypts the data, it leaves transmitted communications open to third-party eavesdropping. To solve the limitations of the classic method, the public key cryptography system was created. In public-key cryptography, the sender encrypts the communication with public-key encryption, and the recipient decrypts it using a private key that is only known to the recipient. The public key in cryptography enables the sharing of information without any third party having access to it.

Become a Cyber Security Professional by enrolling in upGrad’s Cyber Security Program

Are you searching for the optimal programme to accelerate your learning in the domain of Cyber Security? upGrad brings you its Advanced Certificate Programme in Cyber Security in collaboration with the Indian Institute of Information Technology Bangalore

This course includes:

  • 250+ learning hours covering Cyber Security in network security, application security,  cryptography and data secrecy.
  • Certificate of an Advanced Program from IIIT Bangalore and upGrad
  • A profile builder powered by AI
  • One-on-one mentorship for your career
  • One-on-one coaching
  • Alumni status from IIIT Bangalore
  • A portal for exclusive job openings
  • Help with interview preparation

Profile

Pavan Vadapalli

Blog Author
Director of Engineering @ upGrad. Motivated to leverage technology to solve problems. Seasoned leader for startups and fast moving orgs. Working on solving problems of scale and long term technology strategy.

Frequently Asked Questions (FAQs)

1What is a public key?

A public key in cryptography is a large set of random numbers that are used to encrypt the data so that only the recipient having access to the private key can decrypt it.

2Which is more secure: Public Key Cryptography or Secret Key Cryptography?

Public Key Cryptography is more secure as it contains a key pair, public and private key instead of a single secret key that can be used to decrypt the data.

3What are the main benefits of using Public Key Cryptography?

The main benefits of using Public Key Cryptography are confidentiality of the private key, data signatures, and nonrepudiation.

Explore Free Courses

Suggested Blogs

Ethical Hacker Salary India in 2024 [Freshers and Experienced]
903728
Summary: In this article, you will learn about the ethical hacker’s salary in India. Ethical Hacking Job Roles Salary per Annum Ethical
Read More

by Pavan Vadapalli

19 Feb 2024

6 Exciting Cyber Security Project Ideas & Topics For Freshers & Experienced [2024]
152984
Summary: In this article, you will learn the 6 Exciting Cyber Security Project Ideas & Topics. Take a glimpse below. Keylogger projects Network
Read More

by Rohan Vats

19 Feb 2024

Cyber Security Salary in India: For Freshers & Experienced [2024]
905655
Summary: In this article, you will learn about cyber security salaries in India. Take a glimpse below. Wondering what is the range of Cyber Security
Read More

by Pavan Vadapalli

18 Feb 2024

Dijkstra’s Shortest Path Algorithm – A Detailed Overview
2468
What Is Dijkstra Algorithm Shortest Path Algorithm: Explained with Examples The Dutch computer scientist Edsger Dijkstra in 1959, spoke about the sho
Read More

by Pavan Vadapalli

09 Oct 2023

What Is Automotive Cybersecurity? Top 12 Examples
2675
Welcome to a world in which cars are more than simply vehicles; they are intelligent, allied companions on our trips. However, with this technological
Read More

by Pavan Vadapalli

26 Sep 2023

Penetration Testing in Cyber Security: What is it, Types, Pros and Cons
2010
Penetration testing is a controlled hacking method in which a professional pen tester, acting on behalf of a business, uses the same tactics as a crim
Read More

by Rohan Vats

25 Sep 2023

Top 5 Cybersecurity Courses After 12th
3221
The shift to digitisation has opened a host of new career opportunities. Modern technological advancements indicate a need for professionals with soun
Read More

by Pavan Vadapalli

20 Sep 2023

Spoofing in Cybersecurity: How It Works & How To Prevent It?
The need for securing data and online assets is increasing with the rapid evolution of digital media changes. Cybersecurity threats are emerging in ne
Read More

by Pavan Vadapalli

14 Sep 2023

Cryptography in Cybersecurity: Definition, Types & Examples
1071
The increasing digitisation worldwide has made security an indispensable aspect of data protection. This is where cryptography and its applications in
Read More

by Pavan Vadapalli

14 Sep 2023

Schedule 1:1 free counsellingTalk to Career Expert
icon
footer sticky close icon