Cryptography and PKI

12 free practice questions for the CompTIA® Security+® (SY0-801) exam, from the core concepts domain. Pick an answer, then open the explanation to check it.

Every question is original and written for Gapwise with AI. Two separate AI reviewers answered each one without seeing the answer key and checked it against the cited public sources. These are not real exam questions.

Question 1

A design firm encrypts project archives with the Advanced Encryption Standard (AES) and emails the key to a partner office so staff there can open the archives. Which property of this kind of encryption makes emailing the key risky?
  1. A. The same secret key both encrypts and decrypts the data
  2. B. Data encrypted with a public key opens only with its private key
  3. C. The algorithm turns any input into a fixed-length digest
  4. D. Each key is bound to one owner by a signed certificate
Show the answer and explanation

Answer: A. The same secret key both encrypts and decrypts the data

Symmetric algorithms such as AES use one secret key for both encryption and decryption. Anyone who intercepts that key can read everything it protects, so it must reach partners over a protected channel. This key-distribution problem is why systems often use asymmetric key exchange or key wrapping to deliver symmetric keys. Hook: symmetric means the same key, so guard how it travels.

Why each option is right or wrong

  • A. Correct. AES is symmetric, so whoever captures the emailed key can decrypt the archives. Getting a shared secret key to partners safely is the central burden of symmetric encryption.
  • B. Incorrect. That describes asymmetric encryption. AES uses no public or private keys, only one shared secret key.
  • C. Incorrect. That describes hashing, which cannot be reversed. AES output can be decrypted with the key, which is exactly why the key must stay secret.
  • D. Incorrect. Certificates bind public keys to owners in a public key infrastructure (PKI). An AES key has no certificate, and a certificate would not stop an interceptor from using a stolen key.

References

Question 2 Multiple answers

Which two statements describe the Online Certificate Status Protocol (OCSP) rather than certificate revocation lists (CRLs)? (Select two.)
  1. A. The issuer publishes a signed list of revoked serial numbers on a fixed schedule
  2. B. The relying party downloads the whole list and searches it locally
  3. C. A client asks a responder about specific certificates and waits for its reply
  4. D. A newly revoked certificate stays unlisted until the next scheduled update
  5. E. Each signed reply gives a status of good, revoked, or unknown
Show the answer and explanation

Answers: C. A client asks a responder about specific certificates and waits for its reply; E. Each signed reply gives a status of good, revoked, or unknown

OCSP is query-based: a client asks a responder about particular certificates and gets a signed answer of good, revoked, or unknown. CRLs work the other way: the issuer publishes a complete signed list on a schedule, and clients download and search it. Because CRLs change only when reissued, online checking can report revocations sooner. Hook: a CRL is a list you download; OCSP is a question you ask.

Why each option is right or wrong

  • A. Incorrect. That describes a CRL: a time-stamped list that the issuer signs and reissues periodically.
  • B. Incorrect. Downloading the full list and checking it locally is how CRLs work. OCSP answers questions about specific certificates instead.
  • C. Correct. OCSP is a request-and-response protocol. The client holds off accepting the certificates in question until the responder answers.
  • D. Incorrect. This is the timing weakness of CRLs. An online responder can report a revocation as soon as the certification authority (CA) records it.
  • E. Correct. OCSP defines exactly these three status values, and every definitive response is digitally signed.

References

Question 3

A retailer turned on transparent data encryption (TDE) for its order database, and the database server already encrypts its login exchange. During an assessment, a tester on the server network captures traffic between the web servers and the database. The capture shows customer addresses in clear text. Which control addresses this finding?
  1. A. Rotate the TDE key and move it into a network-attached hardware security module
  2. B. Require Transport Layer Security (TLS) for every database connection
  3. C. Turn on full-disk encryption for the web servers' local storage
  4. D. Hash the address fields before the database stores them
Show the answer and explanation

Answer: B. Require Transport Layer Security (TLS) for every database connection

Transparent data encryption protects database files and backups at rest; the database decrypts data for every query it answers. Many databases encrypt only the login exchange by default and send the rest of the session in clear text. Requiring TLS on all client connections, with certificate validation, protects the data in transit. Data at rest and data in transit need separate controls.

Why each option is right or wrong

  • A. Incorrect. TDE and its key protect data stored on disk. Query results still leave the server decrypted, so better key handling changes nothing on the wire.
  • B. Correct. Requiring TLS on all database connections encrypts the query traffic in transit. Clients should also validate the server certificate so an attacker on the segment can't pose as the database.
  • C. Incorrect. This protects data at rest on the web servers. The exposed data was moving across the network between servers.
  • D. Incorrect. Hashing is one-way, so the store could no longer read addresses to ship orders. It is the wrong tool for data the application must use.

References

Question 4

A vendor says its file-transfer product is stronger than a competitor's because it uses 1024-bit RSA keys, while the competitor uses the Advanced Encryption Standard (AES) with 256-bit keys. Which statement BEST evaluates this claim?
  1. A. It fails: RSA-1024 gives at most 80 bits of security, far below AES-256
  2. B. It holds, since each added key bit doubles the attack work for any algorithm
  3. C. It fails, because RSA-1024 only matches the strength of AES-128
  4. D. They are comparable, since both exceed the 112-bit minimum strength
Show the answer and explanation

Answer: A. It fails: RSA-1024 gives at most 80 bits of security, far below AES-256

Security strength, not raw key length, is the fair way to compare different algorithm families. Attacks on RSA, such as factoring, are far more efficient than trying every key, so RSA needs much longer keys for the same strength. NIST rates RSA-1024 at no more than 80 bits and AES-256 at 256 bits. Anything below 112 bits is no longer approved for encrypting data or creating signatures.

Why each option is right or wrong

  • A. Correct. Strength depends on the algorithm, not the raw key length. NIST rates RSA-1024 at no more than 80 bits of security, while AES-256 provides 256 bits.
  • B. Incorrect. Doubling per bit describes brute force against a symmetric key. RSA is attacked by factoring the modulus, which takes far less work than trying every possible key.
  • C. Incorrect. The verdict is right but the reason is wrong. RSA needs a 3072-bit modulus to match AES-128; RSA-1024 provides 80 bits or less.
  • D. Incorrect. AES-256 exceeds 112 bits, but RSA-1024 falls well below it. Strengths under 112 bits are no longer approved for applying protection.

References

Question 5

A nightly script needs a service account password. A developer stores the password in the script's configuration file as Base64 text and reports that the credential is now protected. Why does this give the password little real protection?
  1. A. Base64 is a one-way hash, so the script can never recover the password
  2. B. Base64 uses a short built-in key that attackers can brute-force
  3. C. Base64 hides only part of the password, leaving the rest readable
  4. D. Base64 is a reversible encoding that anyone can decode without a key
Show the answer and explanation

Answer: D. Base64 is a reversible encoding that anyone can decode without a key

Base64 is an encoding: a public, keyless way to represent data, so anyone who can read the file can decode the password in seconds. Obfuscation like this deters only a casual glance. Real protection needs encryption with a properly managed key, or better, a secrets manager that supplies the credential at run time. Never treat encoding as encryption.

Why each option is right or wrong

  • A. Incorrect. Base64 is fully reversible, which is the real problem. If it were a one-way hash, the script couldn't use the password at all.
  • B. Incorrect. Base64 uses no key of any length. Decoding needs nothing but the encoded text.
  • C. Incorrect. Base64 transforms the whole value. Hiding part of a value describes masking, which is a different technique.
  • D. Correct. Encoding only changes how data is represented. Any standard tool turns it back, so it is obfuscation, not protection.

References

Question 6

An analyst keeps client reports on an external hard drive protected by typical volume encryption software. She unlocks the drive and copies several reports to an unencrypted USB flash drive for a partner. The flash drive is later lost, and the finder can read the reports. What BEST explains why the volume encryption didn't protect the copies?
  1. A. Unlocking a volume permanently decrypts its data until an administrator re-encrypts it
  2. B. The volume's 128-bit key was too short, so the finder could decrypt the copies
  3. C. Copies stay encrypted only when the destination drive uses the same volume key
  4. D. Files are decrypted as they are read off the volume, so the copies were written as plaintext
Show the answer and explanation

Answer: D. Files are decrypted as they are read off the volume, so the copies were written as plaintext

Volume encryption protects data only while it sits on that volume. Typical products decrypt files as part of any copy or move, so the destination must protect them. To keep the reports protected in transit, she could encrypt the files themselves or use an encrypted portable container or drive. Think of a locked room: anything carried out the door leaves the lock behind.

Why each option is right or wrong

  • A. Incorrect. Unlocking makes the volume readable while it is mounted; the data on disk stays encrypted. Locking the volume or shutting down restores full protection without any re-encryption.
  • B. Incorrect. A 128-bit key for a modern cipher isn't practical to brute-force. The copies weren't encrypted at all, so key length played no part.
  • C. Incorrect. Volume encryption doesn't follow files to other media, whatever key that media uses. A copy is stored in whatever form the destination provides.
  • D. Correct. Volume encryption decrypts data transparently as it is read, so a copy or move hands plaintext to the destination. The unencrypted flash drive then stored the reports with no protection.

Reference

Question 7 Multiple answers

A tester passively captures traffic on a company's wide area network (WAN) links. No keys or endpoints are compromised. For which two kinds of traffic can the tester read the contents? (Select two.)
  1. A. Site-to-site Internet Protocol Security (IPsec) traffic protected with the Authentication Header (AH)
  2. B. Site-to-site IPsec traffic protected with Encapsulating Security Payload (ESP) and the Advanced Encryption Standard (AES)
  3. C. Domain Name System (DNS) lookups sent to a resolver over Transport Layer Security (TLS)
  4. D. DNS lookups whose answers carry DNS Security Extensions (DNSSEC) signatures
  5. E. Router administration sessions over Secure Shell (SSH)
Show the answer and explanation

Answers: A. Site-to-site Internet Protocol Security (IPsec) traffic protected with the Authentication Header (AH); D. DNS lookups whose answers carry DNS Security Extensions (DNSSEC) signatures

Integrity and authentication are not confidentiality. AH and DNSSEC prove who sent data and that it wasn't changed, but they leave it readable. ESP with encryption, DNS over TLS, and SSH encrypt the payload. Memory hook: a signature is a seal, not an envelope.

Why each option is right or wrong

  • A. Correct. AH authenticates packets and protects their integrity but doesn't encrypt them. Payloads cross the WAN in cleartext that a passive observer can read, though any change would be detected.
  • B. Incorrect. ESP with an encryption algorithm such as AES provides confidentiality as well as integrity. Captured payloads are ciphertext.
  • C. Incorrect. TLS encrypts the session between the client and the resolver, so captured queries and answers are unreadable on the link.
  • D. Correct. DNSSEC signs DNS data so resolvers can verify its origin and integrity. It doesn't encrypt anything, so queries and answers stay readable to a passive observer.
  • E. Incorrect. SSH encrypts the whole session after its key exchange, including passwords and commands. A passive capture shows only ciphertext.

References

Question 8

A factory's monitoring appliance supports only a self-signed certificate for its web console. Engineers on 25 company-managed workstations see a browser warning on every visit and now click through it without reading. Which approach BEST removes the warnings while still letting the browsers detect an impostor console?
  1. A. Configure the browsers to skip certificate validation for the console's address
  2. B. Generate a new self-signed certificate that uses a longer 4096-bit key pair
  3. C. Have each engineer choose to always trust the certificate at the next warning
  4. D. Export the certificate at the appliance and deploy it to the workstations' trust stores
Show the answer and explanation

Answer: D. Export the certificate at the appliance and deploy it to the workstations' trust stores

A self-signed certificate has no third party vouching for it, so trusting it depends on how securely it is distributed. Installing the genuine certificate in managed trust stores makes it a trust anchor for those workstations only. Clicking through warnings, or teaching users to accept certificates on sight, trains them to accept impostors.

Why each option is right or wrong

  • A. Incorrect. Skipping validation removes the warning by removing the check itself. An impostor console would then be accepted silently, which is worse than today.
  • B. Incorrect. Key length doesn't create trust. A longer key still yields a self-signed certificate the browsers have no reason to trust, so the warnings continue.
  • C. Incorrect. Each engineer would trust whatever certificate appears at that moment, without checking it. If an impostor were present then, its certificate would be trusted instead.
  • D. Correct. Taking the certificate directly from the appliance and distributing it through managed trust stores is a secure distribution path. Browsers then trust that exact certificate and warn about any other one an impostor presents.

Reference

  • CSRC Glossaryself-signed certificate (source: NIST SP 800-57 Part 1 Rev. 5)

Question 9

Two factory gateways set up a shared tunnel key with Diffie-Hellman. Each gateway sends its public value in the clear with nothing else attached. A tester on the network path later reads all tunnel traffic without solving any hard math problem. Which addition would have prevented this?
  1. A. Signing each public value with a key the peer can verify through a certificate
  2. B. A larger Diffie-Hellman group, so that computing the shared secret takes far longer
  3. C. New Diffie-Hellman key pairs for every session instead of reusing the same pairs
  4. D. A SHA-256 hash of each public value, sent alongside the value for comparison
Show the answer and explanation

Answer: A. Signing each public value with a key the peer can verify through a certificate

Diffie-Hellman keeps the shared secret from a passive eavesdropper, but on its own it doesn't prove who is at the other end. A man in the middle can run one exchange with each gateway and relay traffic between them, reading everything. Authenticating each side's values, for example with signatures from certified keys, closes the gap. That's why Transport Layer Security (TLS) 1.3 has the server sign the handshake.

Why each option is right or wrong

  • A. Correct. Signing each public value with a long-term private key, checked through a certificate, authenticates the exchange. A tester who swaps in their own value can't produce a valid signature for it.
  • B. Incorrect. The tester never attacked the math. A man in the middle runs a separate exchange with each gateway, so a larger group changes nothing.
  • C. Incorrect. Fresh key pairs give forward secrecy, but nothing proves who sent each value. The tester can substitute their own values in every new exchange.
  • D. Incorrect. A hash uses no key, so the tester can replace a value and send a matching hash of the substitute. It proves nothing about who sent the value.

References

Question 10

A team is moving its backups from the Advanced Encryption Standard (AES) with 128-bit keys to AES with 256-bit keys. Assume no attack is better than trying every possible key. Compared with a 128-bit key, how much more work does an exhaustive search for a 256-bit key need?
  1. A. About 2 times as much
  2. B. About 128 times as much
  3. C. About 2^128 times as much
  4. D. About 2^256 times as much
Show the answer and explanation

Answer: C. About 2^128 times as much

For a symmetric cipher with no shortcut attack, the best attack is trying every key, so strength tracks key length. Each added bit doubles the number of keys. Going from 128 to 256 bits multiplies the search by 2^128, not by the factor of 2 many people expect. This rule holds within one algorithm; RSA and elliptic curve keys follow different strength tables.

Why each option is right or wrong

  • A. Incorrect. Work doesn't grow in proportion to key length. Each added bit doubles the number of possible keys, so 128 extra bits multiply the key space far more than twice.
  • B. Incorrect. Added bits multiply the key space rather than add to it. 128 extra bits double the key count 128 times over, which is far more than 128 times in total.
  • C. Correct. A 256-bit key space holds 2^256 keys and a 128-bit space holds 2^128. Dividing one by the other gives 2^128, so an exhaustive search needs about 2^128 times as much work.
  • D. Incorrect. 2^256 is the total number of 256-bit keys, not the increase over a 128-bit key. The ratio between the two key spaces is 2^128.

Reference

Question 11

A web server's private key was exposed in a leaked backup. The administrator revokes the server's certificate. To get a replacement quickly, she resubmits the certificate signing request (CSR) saved from the original order to the company's internal certification authority (CA), which issues a new certificate. Why doesn't this fix the exposure?
  1. A. The saved CSR contains the exposed private key, which the CA certifies again
  2. B. The CA copies the serial number from the CSR, so the new certificate is already revoked
  3. C. The old CSR carries the old public key, so the new certificate binds the exposed pair
  4. D. A CSR's signature expires with its certificate, so the CA skips checking the request
Show the answer and explanation

Answer: C. The old CSR carries the old public key, so the new certificate binds the exposed pair

A CSR bundles the subject name and one specific public key, signed with the matching private key. The CA turns that name and public key into the certificate. After a private key is exposed, the fix is a new key pair and a new CSR, so the replacement certificate binds a key the attacker doesn't have. Resubmitting the old CSR just certifies the compromised key again.

Why each option is right or wrong

  • A. Incorrect. A CSR never contains the private key. It carries the public key and is signed with the private key, which stays on the server.
  • B. Incorrect. A CSR has no serial number. The CA chooses a new serial number for each certificate it issues, so the new certificate isn't on any revocation list.
  • C. Correct. The CA builds the certificate from the name and public key in the request. Reusing the old CSR certifies the same key pair, so whoever holds the leaked private key can still impersonate the server.
  • D. Incorrect. A CSR's signature doesn't expire with a certificate. The CA can still verify the old CSR, which is exactly why it issued a certificate for the old key.

References

Question 12

A patient portal encrypts each patient's record with its own data encryption key (DEK). Each DEK is stored, wrapped, beside its record. A single key encryption key (KEK) in the key management system wraps every DEK. Policy requires replacing that KEK and then destroying it. What is the LEAST disruptive way to do this while keeping every record readable?
  1. A. Decrypt every record and re-encrypt each one under a newly generated DEK
  2. B. Re-wrap each stored DEK under the new KEK, then destroy the old KEK
  3. C. Destroy the old KEK right away, since the stored DEKs themselves haven't changed
  4. D. Encrypt each record's current ciphertext a second time under the new KEK
Show the answer and explanation

Answer: B. Re-wrap each stored DEK under the new KEK, then destroy the old KEK

This design is envelope encryption: a data key encrypts each record, and a key encryption key wraps the data keys. To retire a KEK, re-wrap each stored DEK under its replacement before destroying the old one. The DEKs don't change, so the records themselves aren't touched. Re-encrypting record data is needed only when a DEK must be replaced.

Why each option is right or wrong

  • A. Incorrect. Re-encrypting every record works but touches all of the data, which is slow and unnecessary here. New DEKs are needed only when the DEKs themselves must change.
  • B. Correct. Re-wrapping changes only the small wrapped copy of each DEK. The DEKs stay the same, so no record needs re-encryption, and the old KEK can then be destroyed safely.
  • C. Incorrect. Every stored DEK is still wrapped under the old KEK. Destroying it first leaves no way to unwrap the DEKs, so every record becomes unreadable.
  • D. Incorrect. Adding a layer reprocesses all of the data, and the inner layer still needs DEKs wrapped under the old KEK. Destroying that KEK would still lock every record.

References