AP Computer Science Principles · Study guide

Safe Computing

AP® Computer Science Principles · Big Idea 5 · Impact of Computing

Safe Computing

How personal information is collected and combined, how passwords, multifactor authentication, encryption, and certificates protect it, and how attackers get in anyway.

1Personal information

Personally identifiable information (PII) is information about a person that identifies them, links to them, relates to them, or describes them. Examples:

Kind of PIIExample
Social Security numbera nine-digit government ID number
Age15 years old
Racea box checked on a form
Phone number(s)a cell number
Medical informationan allergy, a prescription
Financial informationa card number, a bank balance
Biometric dataa fingerprint, a face scan

Much more is recorded as you go about your day. Search engines can keep a history of your searches. Websites can keep a history of who viewed their pages. Devices, websites, and networks can collect your location, and programs can record where you have been, how you got there, and how long you stayed. Technology makes it possible to collect, use, and exploit information about, by, and for individuals, groups, and institutions.

Collection has real benefits:

  • PII and other information online can improve your experience: remembered settings, useful recommendations.
  • PII stored online can make purchases easier: a saved address and card mean one-tap checkout.
  • Search engines can use your search history to suggest websites, and also for targeted marketing (ads chosen for you).

2Combining harmless pieces

Separate pieces of personal data, such as location data, cookies (small files a website stores on your device to remember you), and browsing history, can be aggregated, meaning combined, to create knowledge about one person. Information posted on social media, combined with other sources, can be used to work out private facts you never posted. Here is how it works in a made-up town:

Figure 1. No single piece identifies anyone. Combined, location data, an age setting, a roster, a photo, and a fitness app point to one teenager and where she runs each morning.

She never posted her address or her schedule. Someone who combined five public, harmless-looking pieces could find both. That is why “it's only one small detail” is not a good reason to share it.

3Risks of putting information online

RiskWhat it looks like
Information is used in ways you did not intendan email you sent is forwarded; a post is reshared; a future employer looks at your old social media posts
Information is hard to deletecopies, screenshots, and backups remain after you delete the original
PII can enable crimesit can be used to stalk someone, steal their identity (open accounts in their name), or plan other crimes
Curated information can be exploitedcompanies and governments that collect and sort information can misuse it if privacy protections are ignored
Location is trackeda map app records every trip, and that record can be shared or stolen

4Passwords and multifactor authentication

Authentication means proving you are who you say you are. Authentication measures, such as strong passwords and multifactor authentication, protect devices and information from unauthorized access.

A strong password is easy for you to remember but hard for someone else to guess, even if they know you. A password like Rex2009! looks complex, but anyone who knows your dog's name and birth year can guess it in a few tries. Against a stranger guessing blindly, length matters most. For a made-up attacker who can try 10,000,000,000 passwords per second:

Password made ofExamplePossible passwordsTime to try them all
8 lowercase letterskqzvmbta208,827,064,576about 21 seconds
8 letters and digits, mixed caseq7Rz2mKv218,340,105,584,896about 6 hours
12 lowercase letterskqzvmbtahwpe95,428,956,661,682,176about 110 days
5 random words from a list of 7,776cobalt-moss-tuba-ferry-lamp28,430,288,029,929,701,376about 90 years

Each extra character multiplies the number of possibilities, so 12 lowercase letters take far longer than 8 mixed characters, and a string of random words can be long and still memorable.

Multifactor authentication (MFA) lets you in only after you show several separate pieces of evidence, usually from at least two of three categories: something you know (knowledge), something you have (possession), and something you are (inherence). It requires at least two steps, and each step adds a layer of security that an attacker must break.

Figure 2. Multifactor authentication asks for evidence from at least two different categories, so a stolen password alone does not get in.

Two passwords are not MFA: they are both “something you know.” A password plus a code sent to your phone is.

5Encryption and certificates

Encryption is encoding data so that people without permission cannot read it. Decryption is decoding it back. There are two common approaches:

  • Symmetric key encryption uses one key for both encrypting and decrypting.
  • Public key encryption uses a pair: a public key to encrypt and a private key to decrypt. The sender does not need the receiver's private key to encrypt; the receiver's private key is needed to decrypt.

A toy symmetric cipher shows the idea. Shift every letter forward by the key, 3: MEET AT NOON becomes PHHW DW QRRQ. The receiver shifts back by the same key 3 to read it. Shifting back by 5 instead gives KCCR YR LMML: the wrong key gives nonsense. Real encryption uses far more complicated math, but the rule is the same: with symmetric encryption, both people need the same secret key, so they have to share it safely first.

Figure 3. Symmetric encryption uses one key for both jobs. Public key encryption uses a pair: the public key locks, and only the matching private key unlocks.

Public key encryption solves the sharing problem. Think of the public key as an open padlock you hand out to everyone: anyone can snap it shut on a box, but only you have the key that opens it. That is why your browser can send your password to a website you have never visited before.

But how do you know a public key really belongs to your bank and not to an impostor? Certificate authorities issue digital certificates that confirm who owns an encryption key. They work on a trust model:

Figure 4. A certificate authority vouches that a public key really belongs to the site. This chain of trust is called a trust model.

6Malware, updates, and permissions

TermMeaning
Malwaresoftware meant to damage a computer system or take partial control of it
Computer virusa harmful program that can copy itself and get into a computer without permission; viruses often attach themselves to real programs, then start running on their own

Three habits protect a system:

  • Scan: virus and malware scanning software can help protect a computer against infection.
  • Update: all real-world systems have errors or design flaws that attackers can use. Regular software updates fix those errors.
  • Restrict: you can control what information programs may collect. Review each app's permissions (location, contacts, microphone) to protect your privacy.

7How attackers get in

MethodHow it worksBest defense
Phishinga message pretends to be from someone you trust to fool you into giving personal information, which is then used to get into accounts such as bank accounts and emailcheck the sender and link; MFA, so a stolen password is not enough
Keylogginga program records every key you press, to capture passwords and other private informationmalware scanning; avoid untrustworthy downloads
Rogue access pointa wireless access point that gives unauthorized access to a network; data over public networks can be intercepted, analyzed, and changedavoid unknown networks; use encrypted (HTTPS) connections
Malicious linksa link disguised on a web page or in an email that leads somewhere harmfulcheck where a link really goes before clicking
Unsolicited emails, attachments, and formsmessages you did not ask for can harm a system; they may come from strangers or from a friend whose account was taken overdon't open unexpected attachments or fill in forms inside emails
Untrustworthy downloadsfree programs from freeware or shareware sites can hide malwaredownload only from trusted sources
A made-up phishing email (warning signs highlighted)
From: Brookfield Bank Security <alerts@brookfie1d-bank.co>
Subject: URGENT: your account will be locked in 24 hours

We noticed unusual activity. Confirm your identity now:
   [ Verify my account ]  -> http://brookfie1d-bank.co/login
Attached: Account_Statement.pdf.exe

Three warning signs: the sender's address spells the bank's name with a digit 1 in place of an L, the message rushes you with a threat, and the attachment ends in .exe, a program, not a PDF.

Figure 5. Data sent over a public network can be intercepted, analyzed, and modified. A rogue access point sits between you and the real network.
The key idea

PII and everyday data such as searches, page views, and location can be collected and combined to reveal private facts, and information online is hard to delete. Strong passwords, multifactor authentication, encryption (symmetric: one key; public key: a public and private pair), certificate authorities, malware scanning, updates, and permission settings protect people. Attackers get in through phishing, keylogging, rogue access points, malicious links, unsolicited emails, and untrustworthy downloads.

8Worked examples

Worked Example 1 Spot the aggregation

The vacation posts

A student posts a beach photo tagged with the location, a post saying “one week away!”, and earlier a photo of the front of her house. Explain the privacy risk.

  1. 1
    Each post alone looks harmless.
  2. 2
    Combined, they show where she lives and that the house is empty for a week.
  3. 3
    Someone could use that to plan a burglary: PII aiding a crime.
Answer: Aggregating the posts reveals an empty home and its address.
Worked Example 2 Is it multifactor?

Three logins

Which use multifactor authentication? (a) a password and a security question; (b) a password and a code texted to your phone; (c) a fingerprint and a PIN.

  1. 1
    (a) Both are something you know: one category, so not MFA.
  2. 2
    (b) Something you know plus something you have: MFA.
  3. 3
    (c) Something you are plus something you know: MFA.
Answer: (b) and (c).
Worked Example 3 Choose the encryption

A stranger's website

You are buying something from a website you have never used. Why does your browser use public key encryption to start the connection instead of symmetric encryption?

  1. 1
    Symmetric encryption needs a key both sides already share, and you share none with this site.
  2. 2
    With public key encryption, the site publishes its public key; your browser locks data with it.
  3. 3
    Only the site's private key can unlock it, and a certificate authority confirms the public key is really the site's.
Answer: Public key encryption works without a shared secret; a certificate proves whose key it is.
Worked Example 4 Name the attack

Four situations

Name each: (a) a free game installer secretly records everything you type; (b) a text with a link to a fake school login page; (c) a Wi-Fi network called “Airport_Free” set up by a stranger; (d) a program that copies itself into other programs.

  1. 1
    (a) Recording keystrokes: keylogging, arriving through an untrustworthy download.
  2. 2
    (b) Fooling you into giving your login: phishing with a malicious link.
  3. 3
    (c) An unauthorized wireless network: a rogue access point.
  4. 4
    (d) Copies itself and attaches to real programs: a virus.
Answer: (a) keylogging, (b) phishing, (c) rogue access point, (d) virus.
Worked Example 5 Judge a password

Which is strongest?

Dana loves her cat Pixel and was born in 2008. Rank these: Pixel2008!, kqzvmbta, cobalt-moss-tuba-ferry-lamp.

  1. 1
    Pixel2008! uses facts friends know: a person who knows Dana could guess it quickly. Weakest.
  2. 2
    kqzvmbta is random but short: about 21 seconds for the made-up attacker.
  3. 3
    The five random words are long, unrelated to Dana, and memorable: about 90 years.
Answer: Strongest: the five random words; then kqzvmbta; weakest: Pixel2008!.

9Common mistakes

Common Mistake 1 · Thinking one detail can't hurt

Privacy risk comes from combining pieces. A detail that seems harmless can be the one that completes the picture.

Common Mistake 2 · Calling two passwords multifactor

MFA needs different kinds of evidence: know, have, are.

Common Mistake 3 · Mixing up the keys

In public key encryption, the public key encrypts and the private key decrypts. The private key is never shared.

Common Mistake 4 · Thinking phishing guesses passwords

In phishing, you type your real password into the attacker's page. A strong password does not help; MFA and caution do.

Common Mistake 5 · Judging a password by symbols alone

A password built from your pet's name is weak even with symbols, because people who know you can guess it.

Explain a safe computing choice like this

“Turning on multifactor authentication protects the account because a phished password is only something the attacker knows. To log in, they would also need the phone that receives the code, which is something the user has, so the stolen password alone is not enough.”

Name the threat, the protection, and how the protection stops that specific threat.