---
title: "Public Key Encryption — AP CSP Definition & Exam Guide"
description: "Public key encryption uses a public key to encrypt and a private key to decrypt, so strangers can communicate securely. Core to AP CSP Topic 5.6 Safe Computing."
canonical: "https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption"
type: "key-term"
subject: "AP Computer Science Principles"
unit: "Unit 5"
---

# Public Key Encryption — AP CSP Definition & Exam Guide

## Definition

Public key encryption (asymmetric encryption) is a method that uses two mathematically linked keys, a public key anyone can use to encrypt a message and a private key only the receiver holds to decrypt it, letting two parties communicate securely without ever sharing a secret key.

## What It Is

Public key encryption is a way to scramble [data](/ap-comp-sci-p/unit-2/extracting-information-data/study-guide/EFuLgc6tL71cegDFjXRl "fv-autolink") using a *pair* of keys instead of one. The **public key** is shared openly, and anyone can use it to encrypt a message. The **private key** is kept secret by the [receiver](/ap-comp-sci-p/key-terms/receiver "fv-autolink"), and it's the only thing that can decrypt that message. Because the keys do different jobs, this is also called **asymmetric encryption**.

Here's the part that makes it click. The big [problem](/ap-comp-sci-p/unit-3/algorithmic-efficiency/study-guide/jGSWIqW49BtrQ8dqCWFd "fv-autolink") with single-key (symmetric) encryption is the chicken-and-egg issue. How do you secretly share the key with someone if you don't already have a secure channel? Public key encryption solves it. Think of it like a mailbox with a mail slot. Anyone can drop a letter in (encrypt with the public key), but only the person with the mailbox key (the private key) can open it and read what's inside. The sender never needs to know the receiver's private key, which is exactly why strangers on the internet, like you and an online store, can exchange sensitive data safely.

## Why It Matters

Public key encryption lives in **Topic 5.6 Safe Computing** in **[Unit 5](/ap-comp-sci-p/unit-5 "fv-autolink"): Impact of Computing**, under learning objective **[AP Comp Sci P](/ap-comp-sci-p "fv-autolink") 5.6.B** (explain how computing resources can be protected and can be misused). Topic 5.6 covers two sides of one coin. Attackers can intercept data sent over public networks (think rogue access points and keylogging under 5.6.C), and public key encryption is one of the main defenses. It's the technology behind the padlock icon in your browser, working alongside digital certificates and certificate authorities to verify you're actually talking to the real website. On the exam, it connects the privacy risks of 5.6.A (your PII traveling across networks) to the protections of 5.6.B.

## Connections

### Encryption and Symmetric Encryption (Unit 5)

[Encryption](/ap-comp-sci-p/key-terms/encryption "fv-autolink") is the umbrella term for encoding data so unauthorized parties can't read it. Symmetric encryption uses one shared key for both encrypting and decrypting, while public key encryption uses a pair. Public key encryption exists specifically to fix symmetric encryption's weakness, the awkward problem of securely sharing the key in the first place.

### Digital Certificates and Certificate Authorities (Unit 5)

Public key encryption has a trust problem. How do you know the public key you grabbed actually belongs to your bank and not an impostor? Digital certificates, issued and verified by certificate authorities, vouch that a public key really belongs to who it claims to. Together they make HTTPS work.

### Data Interception on Public Networks (Unit 5)

The CED says data sent over public networks can be intercepted, analyzed, and modified, for example through a [rogue access point](/ap-comp-sci-p/key-terms/rogue-access-point "fv-autolink"). Public key encryption is the countermeasure. An attacker can capture your encrypted packets all day, but without the private key the data is unreadable gibberish.

### PII and Privacy Risks (Unit 5)

[Topic 5.6](/ap-comp-sci-p/unit-5/safe-computing/study-guide/zMi0PutBHnDjIlOB5lMs "fv-autolink").A covers how personally identifiable information like financial data, medical info, and biometric data gets collected and stored. Public key encryption is how that PII survives the trip across the internet, which is why your browser uses it before sending payment information to a retailer's server.

## On the AP Exam

Public key encryption shows up in multiple-choice questions, since the AP CSP exam has no FRQ on this topic. Expect scenario-based stems rather than bare definitions. A typical question describes a browser sending sensitive payment information to an online retailer and asks which encryption method fits, or describes a user encrypting a confidential message and asks you to name the process. You need to do three things: identify which key does which job (public encrypts, private decrypts), explain why the sender never needs the receiver's private key, and recognize public key encryption as the answer when a scenario involves secure communication between parties who have never met. Watch for distractors that flip the keys or describe symmetric encryption.

## Public Key Encryption vs Symmetric Encryption

Symmetric encryption uses one shared secret key for both encrypting and decrypting, so both parties must already have the same key. Public key (asymmetric) encryption uses two different keys, a public one to lock and a private one to unlock. The exam tell is the key count and the sharing problem. If the scenario involves strangers communicating securely without exchanging a secret beforehand, it's public key encryption.

## Key Takeaways

- Public key encryption uses two keys: a public key that anyone can use to encrypt a message, and a private key that only the receiver holds and uses to decrypt it.
- The sender never needs the receiver's private key, which solves the key-sharing problem that symmetric (single-key) encryption can't handle on its own.
- It falls under Topic 5.6 Safe Computing and learning objective AP Comp Sci P 5.6.B, as a way computing resources and data are protected from unauthorized access.
- It defends against data interception on public networks; an attacker can capture encrypted traffic but can't read it without the private key.
- Digital certificates from certificate authorities verify that a public key truly belongs to its claimed owner, which is what makes HTTPS trustworthy.
- On the exam, scenarios about sending sensitive data (like payment info) to a server you've never communicated with before point to public key encryption.

## FAQs

### What is public key encryption in AP CSP?

It's an encryption method that uses a pair of keys, a public key anyone can use to encrypt a message and a private key only the receiver holds to decrypt it. It appears in Topic 5.6 Safe Computing under learning objective AP Comp Sci P 5.6.B.

### Is the public key used to decrypt messages?

No. The public key only encrypts. Only the matching private key can decrypt the message, which is the whole point. Anyone can lock a message for you, but only you can unlock it.

### What's the difference between public key encryption and symmetric encryption?

Symmetric encryption uses one shared key for both encrypting and decrypting, so both parties need the same secret in advance. Public key encryption uses two different keys, so a sender can encrypt without ever knowing the receiver's secret. That's why it works between strangers on the internet.

### Why is public key encryption called asymmetric?

Because the two keys do different jobs and aren't interchangeable. The public key encrypts and the private key decrypts, unlike symmetric encryption where one key does both.

### Do I need to know the math behind public key encryption for the AP exam?

No. AP CSP only expects you to understand the concept: which key does what, why the sender doesn't need the private key, and when a scenario calls for it (like a browser sending payment info to a server). The underlying math is beyond the course.

## Related Study Guides

- [Big Idea 5 Overview: Impact of Computing](/ap-comp-sci-p/unit-5/review/study-guide/5aed2VkfxMBYFkBVCEhn)
- [5.6 Safe Computing](/ap-comp-sci-p/unit-5/safe-computing/study-guide/zMi0PutBHnDjIlOB5lMs)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption#resource","name":"Public Key Encryption — AP CSP Definition & Exam Guide","url":"https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T00:50:13.527Z","isPartOf":{"@type":"Collection","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption#term","name":"Public Key Encryption","description":"Public key encryption (asymmetric encryption) is a method that uses two mathematically linked keys, a public key anyone can use to encrypt a message and a private key only the receiver holds to decrypt it, letting two parties communicate securely without ever sharing a secret key.","url":"https://fiveable.me/ap-comp-sci-p/key-terms/public-key-encryption","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Computer Science Principles Key Terms","url":"https://fiveable.me/ap-comp-sci-p/key-terms"},"educationalAlignment":[{"@type":"AlignmentObject","alignmentType":"educationalSubject","educationalFramework":"AP® Course and Exam Description","targetName":"AP® Computer Science Principles Unit 5, Topic 5.6, LO 5.6.A"},{"@type":"AlignmentObject","alignmentType":"educationalSubject","educationalFramework":"AP® Course and Exam Description","targetName":"AP® Computer Science Principles Unit 5, Topic 5.6, LO 5.6.B"},{"@type":"AlignmentObject","alignmentType":"educationalSubject","educationalFramework":"AP® Course and Exam Description","targetName":"AP® Computer Science Principles Unit 5, Topic 5.6, LO 5.6.C"}]},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is public key encryption in AP CSP?","acceptedAnswer":{"@type":"Answer","text":"It's an encryption method that uses a pair of keys, a public key anyone can use to encrypt a message and a private key only the receiver holds to decrypt it. It appears in Topic 5.6 Safe Computing under learning objective AP Comp Sci P 5.6.B."}},{"@type":"Question","name":"Is the public key used to decrypt messages?","acceptedAnswer":{"@type":"Answer","text":"No. The public key only encrypts. Only the matching private key can decrypt the message, which is the whole point. Anyone can lock a message for you, but only you can unlock it."}},{"@type":"Question","name":"What's the difference between public key encryption and symmetric encryption?","acceptedAnswer":{"@type":"Answer","text":"Symmetric encryption uses one shared key for both encrypting and decrypting, so both parties need the same secret in advance. Public key encryption uses two different keys, so a sender can encrypt without ever knowing the receiver's secret. That's why it works between strangers on the internet."}},{"@type":"Question","name":"Why is public key encryption called asymmetric?","acceptedAnswer":{"@type":"Answer","text":"Because the two keys do different jobs and aren't interchangeable. The public key encrypts and the private key decrypts, unlike symmetric encryption where one key does both."}},{"@type":"Question","name":"Do I need to know the math behind public key encryption for the AP exam?","acceptedAnswer":{"@type":"Answer","text":"No. AP CSP only expects you to understand the concept: which key does what, why the sender doesn't need the private key, and when a scenario calls for it (like a browser sending payment info to a server). The underlying math is beyond the course."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Computer Science Principles","item":"https://fiveable.me/ap-comp-sci-p"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-comp-sci-p/key-terms"},{"@type":"ListItem","position":3,"name":"Unit 5","item":"https://fiveable.me/ap-comp-sci-p/unit-5"},{"@type":"ListItem","position":4,"name":"Public Key Encryption"}]}]}
```
