Explore Courses
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Birla Institute of Management Technology Birla Institute of Management Technology Post Graduate Diploma in Management (BIMTECH)
  • 24 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Popular
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science & AI (Executive)
  • 12 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
University of MarylandIIIT BangalorePost Graduate Certificate in Data Science & AI (Executive)
  • 8-8.5 Months
upGradupGradData Science Bootcamp with AI
  • 6 months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
OP Jindal Global UniversityOP Jindal Global UniversityMaster of Design in User Experience Design
  • 12 Months
Popular
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Rushford, GenevaRushford Business SchoolDBA Doctorate in Technology (Computer Science)
  • 36 Months
IIIT BangaloreIIIT BangaloreCloud Computing and DevOps Program (Executive)
  • 8 Months
New
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Popular
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
Golden Gate University Golden Gate University Doctor of Business Administration in Digital Leadership
  • 36 Months
New
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
Popular
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
Bestseller
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
IIIT BangaloreIIIT BangalorePost Graduate Certificate in Machine Learning & Deep Learning (Executive)
  • 8 Months
Bestseller
Jindal Global UniversityJindal Global UniversityMaster of Design in User Experience
  • 12 Months
New
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in AI and Emerging Technologies (Blended Learning Program)
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
ESGCI, ParisESGCI, ParisDoctorate of Business Administration (DBA) from ESGCI, Paris
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration From Golden Gate University, San Francisco
  • 36 Months
Rushford Business SchoolRushford Business SchoolDoctor of Business Administration from Rushford Business School, Switzerland)
  • 36 Months
Edgewood CollegeEdgewood CollegeDoctorate of Business Administration from Edgewood College
  • 24 Months
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with Concentration in Generative AI
  • 36 Months
Golden Gate University Golden Gate University DBA in Digital Leadership from Golden Gate University, San Francisco
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA by Liverpool Business School
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA (Master of Business Administration)
  • 15 Months
Popular
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Business Administration (MBA)
  • 12 Months
New
Deakin Business School and Institute of Management Technology, GhaziabadDeakin Business School and IMT, GhaziabadMBA (Master of Business Administration)
  • 12 Months
Liverpool John Moores UniversityLiverpool John Moores UniversityMS in Data Science
  • 18 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityMaster of Science in Artificial Intelligence and Data Science
  • 12 Months
Bestseller
IIIT BangaloreIIIT BangalorePost Graduate Programme in Data Science (Executive)
  • 12 Months
Bestseller
O.P.Jindal Global UniversityO.P.Jindal Global UniversityO.P.Jindal Global University
  • 12 Months
WoolfWoolfMaster of Science in Computer Science
  • 18 Months
New
Liverpool John Moores University Liverpool John Moores University MS in Machine Learning & AI
  • 18 Months
Popular
Golden Gate UniversityGolden Gate UniversityDBA in Emerging Technologies with concentration in Generative AI
  • 3 Years
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (AI/ML)
  • 36 Months
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDBA Specialisation in AI & ML
  • 36 Months
Golden Gate University Golden Gate University Doctor of Business Administration (DBA)
  • 36 Months
Bestseller
Ecole Supérieure de Gestion et Commerce International ParisEcole Supérieure de Gestion et Commerce International ParisDoctorate of Business Administration (DBA)
  • 36 Months
Rushford, GenevaRushford Business SchoolDoctorate of Business Administration (DBA)
  • 36 Months
Liverpool Business SchoolLiverpool Business SchoolMBA with Marketing Concentration
  • 18 Months
Bestseller
Golden Gate UniversityGolden Gate UniversityMBA with Marketing Concentration
  • 15 Months
Popular
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Corporate & Financial Law
  • 12 Months
Bestseller
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Intellectual Property & Technology Law
  • 12 Months
Jindal Global Law SchoolJindal Global Law SchoolLL.M. in Dispute Resolution
  • 12 Months
IIITBIIITBExecutive Program in Generative AI for Leaders
  • 4 Months
New
IIIT BangaloreIIIT BangaloreExecutive Post Graduate Programme in Machine Learning & AI
  • 13 Months
Bestseller
upGradupGradData Science Bootcamp with AI
  • 6 Months
New
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
KnowledgeHut upGradKnowledgeHut upGradSAFe® 6.0 Certified ScrumMaster (SSM) Training
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutCertified ScrumMaster®(CSM) Training
  • 16 Hours
upGrad KnowledgeHutupGrad KnowledgeHutLeading SAFe® 6.0 Certification
  • 16 Hours
KnowledgeHut upGradKnowledgeHut upGradPMP® certification
  • Self-Paced
upGrad KnowledgeHutupGrad KnowledgeHutAWS Solutions Architect Certification
  • 32 Hours
upGrad KnowledgeHutupGrad KnowledgeHutAzure Administrator Certification (AZ-104)
  • 24 Hours
KnowledgeHut upGradKnowledgeHut upGradAWS Cloud Practioner Essentials Certification
  • 1 Week
KnowledgeHut upGradKnowledgeHut upGradAzure Data Engineering Training (DP-203)
  • 1 Week
MICAMICAAdvanced Certificate in Digital Marketing and Communication
  • 6 Months
Bestseller
MICAMICAAdvanced Certificate in Brand Communication Management
  • 5 Months
Popular
IIM KozhikodeIIM KozhikodeProfessional Certification in HR Management and Analytics
  • 6 Months
Bestseller
Duke CEDuke CEPost Graduate Certificate in Product Management
  • 4-8 Months
Bestseller
Loyola Institute of Business Administration (LIBA)Loyola Institute of Business Administration (LIBA)Executive PG Programme in Human Resource Management
  • 11 Months
Popular
Goa Institute of ManagementGoa Institute of ManagementExecutive PG Program in Healthcare Management
  • 11 Months
IMT GhaziabadIMT GhaziabadAdvanced General Management Program
  • 11 Months
Golden Gate UniversityGolden Gate UniversityProfessional Certificate in Global Business Management
  • 6-8 Months
upGradupGradContract Law Certificate Program
  • Self paced
New
IU, GermanyIU, GermanyMaster of Business Administration (90 ECTS)
  • 18 Months
Bestseller
IU, GermanyIU, GermanyMaster in International Management (120 ECTS)
  • 24 Months
Popular
IU, GermanyIU, GermanyB.Sc. Computer Science (180 ECTS)
  • 36 Months
Clark UniversityClark UniversityMaster of Business Administration
  • 23 Months
New
Golden Gate UniversityGolden Gate UniversityMaster of Business Administration
  • 20 Months
Clark University, USClark University, USMS in Project Management
  • 20 Months
New
Edgewood CollegeEdgewood CollegeMaster of Business Administration
  • 23 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
The American Business SchoolThe American Business SchoolMBA with specialization
  • 23 Months
New
Aivancity ParisAivancity ParisMSc Artificial Intelligence Engineering
  • 24 Months
Aivancity ParisAivancity ParisMSc Data Engineering
  • 24 Months
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGrad KnowledgeHutupGrad KnowledgeHutData Engineer Bootcamp
  • Self-Paced
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
KnowledgeHut upGradKnowledgeHut upGradBackend Development Bootcamp
  • Self-Paced
upGradupGradUI/UX Bootcamp
  • 3 Months
upGradupGradCloud Computing Bootcamp
  • 7.5 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 5 Months
upGrad KnowledgeHutupGrad KnowledgeHutSAFe® 6.0 POPM Certification
  • 16 Hours
upGradupGradDigital Marketing Accelerator Program
  • 05 Months
upGradupGradAdvanced Certificate Program in GenerativeAI
  • 4 Months
New
upGradupGradData Science Bootcamp with AI
  • 6 Months
Popular
upGradupGradFull Stack Software Development Bootcamp
  • 6 Months
Bestseller
upGradupGradUI/UX Bootcamp
  • 3 Months
PwCupGrad CampusCertification Program in Financial Modelling & Analysis in association with PwC India
  • 4 Months
upGradupGradCertificate Course in Business Analytics & Consulting in association with PwC India
  • 06 Months
upGradupGradDigital Marketing Accelerator Program
  • 05 Months

Public Key Cryptography Beginner’s Guide: How Does it Work?

Updated on 30 November, 2022

5.25K+ views
7 min read

Data is an invaluable resource in today’s competitive business environment. Thus, businesses must maintain data secrecy and security while controlling access to data. Moreover, with digitization becoming a norm and organizations automating their data processing operations, the chances of unauthorized access to sensitive data increase. Hence, businesses must establish a secure environment that protects valuable data and mitigates potential data threats. 

Cryptography plays a critical role in data security to maintain confidentiality and integrity. A subtype of cryptography, public-key encryption or public-key cryptography, forms a crucial component in most data security policies worldwide. 

This article will explore the concept of a public key in cryptography and its utility in protecting data.

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.

What is cryptography in data security?

Cryptography refers to a set of techniques for protecting information and communications by disguising data so that only the intended recipient can process and read the contents. It relies on algorithms to encrypt data that only authorized individuals can decipher. Thus, cryptography mainly involves scrambling plaintext or ordinary text into ciphertext (encryption) and then reverting (decryption).

The word cryptography has its roots in the Greek term ‘Kryptos,’ meaning ‘hidden.’ Some of the earliest records of the use of cryptography dates back to the ancient Egyptians and Romans, including Julius Caesar’s famous Caesar cipher. Although the techniques used in the old days seem primitive and straightforward in today’s age and time, the ancient ciphers are a striking reminder of the necessity to protect sensitive information. With the evolution of technology, cryptography today has numerous applications, including digital signatures, internet browsing, messenger apps, emails, credit card transactions, online verifications, and cryptographic key generation.

What is a key in cryptography?

In cryptography, a key is a string of random characters in a defined order used to alter or scramble data within an encryption algorithm. In other words, a key in cryptography encrypts or locks data so that only someone with a valid key can decrypt or unlock it. The plaintext is the original data, and the ciphertext is after the key encrypts it. 

Cryptography plays a massive role in data security systems. There are two broad classifications of cryptographic algorithms, symmetric-key algorithms (secret key algorithms) and asymmetric key algorithms (public key algorithms).

Meaning of Public-Key Cryptography

Public-key cryptography or asymmetric key encryption is a cryptography process where data is encrypted and decrypted using different keys. Although the keys are different, they are mathematically related to facilitating plaintext retrieval by decrypting the ciphertext. The most commonly used form of public-key encryption is based on the RSA algorithm.

In the asymmetric encryption process, one key encrypts the data, and another but corresponding key decrypts the data. The key that encrypts data is the public key, while a private key decrypts the information.

Moreover, the public key is widely known, whereas the private key is a secret. It means that while other people can use your public key to send you encrypted information, only you have access to the private or secret key to decode the text.

Advantages of Public-Key Cryptography

Public-key cryptography has the following functionalities:

  • Encryption and decryption: The encryption and decryption features enable two parties to communicate with each other by disguising the information they exchange. The sender scrambles or encrypts the data before sending it, and the recipient unscrambles or decrypts the data after receiving it. Meanwhile, the encrypted data in transit remains incomprehensible to third parties.
  • Nonrepudiation: Public-key encryption has a security mechanism called nonrepudiation that prevents data alteration and ensures that no party can deny that they received/sent a message via encryption.

Public-Key Cryptography vs. Private Key Cryptography

Unlike a public-key encryption system, symmetric or private key cryptography involves the sender and receiver sharing a single, common key that encrypts and decrypts messages. Thus, symmetric key encryption algorithms create a block cipher of a fixed length of bits with a secret key that the sender uses to encrypt data and the recipient uses to decode or decrypt it. A classic example of private key cryptography is the AES or Advanced Encryption Standard established by the National Institute of Standards and Technology (NIST) in November 2001.

So, what are the key differences between public-key cryptography and private key cryptography? The following table highlights the distinctions.

Public-Key Cryptography Private-Key Cryptography
A public key/two key cryptography system involving two keys. A secret/single key cryptography system using only one key.
Anybody can use the public key to encrypt data whereas only the recipient knows the private key and uses it for data decryption. Both the sender and the receiver share the same key.
Parties are not equal, hence asymmetric. Symmetric because parties are equal.
The party that encrypts messages cannot decrypt messages. Since parties are equal, the receiver can forge a message and falsely claim it is sent by the sender.

The RSA Algorithm Behind Public-Key Encryption

The RSA algorithm is a widely used asymmetric cryptographic algorithm relying on a public key and a private key to encrypt and decrypt messages. Created in 1978, the RSA algorithm is named after Ron Rivest, Adi Shamir, and Leonard Adleman, its inventors. 

Here’s a simplified explanation of how the RSA algorithm in public-key encryption works:

1. Generation of keys

  • Select two large prime numbers ‘p’ and ‘q.’
  • Calculate n = p*q
  • Find out the totient function: Φ(n) = (p-1)(q-1)
  • Now, select an integer ‘e’ which is co-prime to Φ(n) and 1 < e < Φ(n).
  • The pair (n,e) is the public key.
  • Now, calculate ‘d’ such that d.e = 1 mod Φ(n) or 1 mod (p-1)(q-1)
  • Use the extended Euclidean algorithm to find out d. The private key is the pair (n,d).

2. Encryption

  • A given plaintext ‘P’ is a series of numbers less than n. If the ciphertext is ‘C,’ the encryption is done using the following mathematical step:

C = Pe mod n

3. Decryption

  • The plaintext can be retrieved using the private key (n,d) in the following step:

P = Cd mod n

The following pseudocode is an example of the RSA algorithm in action:

int x = 61, int y = 53;

int n = x * y;

// n = 3233.

// compute the totient, phi

int phi = (x-1)*(y-1);

// phi = 3120.

int e = findCoprime(phi);

// find an ‘e’ which is > 1 and is a co-prime of phi.

// e = 17 satisfies the current values.

// Using the extended euclidean algorithm, find ‘d’ which satisfies 

// this equation:

d = (1 mod (phi))/e;

// d = 2753 for the example values.

public_key = (e=17, n=3233);

private_key = (d=2753, n=3233);

// Given the plaintext P=123, the ciphertext C is :

C = (123^17) % 3233 = 855;

// To decrypt the cypher text C:

P = (855^2753) % 3233 = 123;

Conclusion

Private key cryptography is the traditional encryption system. However, it leaves transmitted messages vulnerable to interception by third parties because a single secret key encrypts and deciphers the data. Thus, cryptologists developed the public-key cryptography system to address the limitation of the conventional system. In public-key cryptography, the sender encrypts the message using a public key, whereas the receiver can decode the message with a private key available only with the receiver. As a result, third parties cannot read the message in transit because only the receiver’s private key can decipher it. Public-key cryptography systems mostly use the RSA algorithm and play a vital role in modern encryption technologies.

Join upGrad in Your Journey Towards Becoming a Data Security Professional

Are you looking for a comprehensive platform to learn data security? Your search ends with the Cybersecurity Certificate Program from upGrad in partnership with Purdue University. The 8-months online course is suitable for entry-level to mid-level IT professionals, technical professionals, tech support professionals, analysts, engineers, and fresh graduates.

Program Highlights:

  • Certificate of recognition from upGrad and Purdue University
  • 300+ learning hours, 15+ live sessions, and four projects
  • Comprehensive syllabus covering cryptography and encryption
  • Learn relevant programming languages and tools
  • Industry and peer networking
  • 360-degree learning support

Frequently Asked Questions (FAQs)

1. What is meant by public key?

A public key refers to a large numerical value for encrypting data in cryptography. In other words, a public key in cryptography converts data into an unreadable format. A different but mathematically linked private then decrypts the data.

2. How is a secret key different from a public key?

A single shared key encrypts and decodes the message in secret key encryption. On the contrary, public-key encryption employs two different but mathematically related keys (public and private) for the encryption and decryption process.

3. What are the applications of public-key cryptography?

The primary applications of public-key cryptography are data encryption and digital signatures. Public-key cryptography ensures data security through authentication and nonrepudiation.

RELATED PROGRAMS