Skip to content
Tech Interview Prep
Technical interview guide

Encryption Fundamentals

Symmetric vs. asymmetric encryption, hashing, and how TLS combines them.

Read
30 min
Practice MCQs
25
Interview Q&A
25
Edition
v3
Editorial status
Reviewed

Scope: FIPS 197 update 1, NIST SP 800-57 Part 1 Rev. 5, RFC 8446, and official OWASP guidance accessed 2026-08-31..

Curated: · Written: · Reviewed:

25 questions

MCQ-2A service encrypts each 5 GiB archive by splitting it into 190-byte blocks and encrypting every block with RSA-OAEP under the recipient's RSA-2048 public key. The encryption runs single-threaded and takes about 28 minutes on a 4-core host. On that host, AES-256-GCM runs at 1.5 GiB/s with AES-NI and one RSA-2048 public-key operation takes 0.06 ms; RSA PKCS#1 v1.5 can encrypt up to 245 bytes per operation. Which change makes encryption finish in seconds while keeping the archive confidential and decryptable by the recipient?
MCQ-3A team must ship a 2 GiB nightly backup to an offsite archive. One engineer proposes encrypting the whole file directly with the archive server's RSA-2048-OAEP (SHA-256) public key. On the team's reference core, RSA-2048-OAEP encryption runs at about 1,000 operations per second and AES-256-GCM at about 1 GiB/s. What is the outcome of the proposal?
MCQ-4A team is specifying a protocol for browsers to talk to servers they have never contacted before, over a network an attacker can read and modify. The design must also keep past sessions confidential if a server's long-term private key leaks later. The draft uses X25519 ECDHE in the handshake and AES-128-GCM for records. Which statement correctly justifies using both kinds of cryptography?
MCQ-7A payroll service stores each employee record as a fixed 48-byte value encrypted with AES-128-ECB under one key: a 16-byte constant header, a 16-byte department name padded with spaces, and a 16-byte salary as a zero-padded decimal string. An attacker obtains only the ciphertext column. What can the attacker determine?
MCQ-5A service encrypts each tenant's records with AES-256-GCM, passing the record's tenant ID as the additional authenticated data and storing the 16-byte tag alongside the ciphertext. A refactor introduces a bug: on decryption the service passes the tenant ID of the requesting tenant instead of the tenant that owns the record. Tenant B requests a record owned by tenant A. What does the service observe?
MCQ-25A telemetry service encrypts about 2,000 messages per second (~40 GB/day) with a custom protocol: AES-128-CTR using a 64-bit counter as the nonce, plus HMAC-SHA-256 over the ciphertext (encrypt-then-MAC). The counter lives in memory and resets to zero on every process restart, which happens about three times a day. An engineer notices that the first message after a restart is byte-identical to the first message after an earlier restart whenever the two plaintexts are identical. Which statement about this design is correct?
MCQ-6A telemetry service encrypts each reading with AES-128-GCM. The 96-bit nonce is the current Unix time in milliseconds, zero-padded. The key is generated once at deployment and never rotated. During a burst, two readings are encrypted in the same millisecond, and an attacker captures both ciphertexts and their 16-byte tags. What can the attacker do?
MCQ-17A compliance archive writes about 2 million records a month, each encrypted with AES-256-GCM under a KMS key that is rotated every 90 days; the KMS retains every previous key version. Each row stores the 96-bit nonce, the ciphertext and the 128-bit tag. A backfill re-reading 18 months of records fails with an authentication error on every row written before the most recent rotation, about 30 million of the 36 million, while the 6 million written since decrypt normally. What change fixes the backfill?
MCQ-12A fleet of 5,000 weather sensors reports to a gateway over a radio link an attacker can modify. Every sensor is provisioned at manufacture with the same 256-bit key, which the gateway also holds; readings are public, and no party outside the fleet and the gateway ever verifies one. Which mechanism should a sensor use so the gateway can detect a modified reading?
MCQ-13A CI job downloads `libfoo-2.4.1.tar.gz` (8.2 MB) over plain HTTP from `mirror.example.net`, a third-party mirror the team does not control, and compares the file's SHA-256 against the digest printed on that mirror's `/libfoo/2.4.1/SHA256SUMS` page. The comparison passes on every run. The team wants the check to establish that the tarball is the one libfoo published. Which change to the job would make the check establish that?
MCQ-11Your release pipeline downloads `agent-3.7.0.tar.gz` and its detached Ed25519 signature, verifies the signature against the pinned `release-2024` public key, and confirms the tarball's SHA-256 equals the digest inside the signed manifest. Both checks pass, and the pipeline publishes the artifact using a separate registry token. A week later the tarball is found to run a credential-exfiltrating postinstall script. The `release-2024` key was never rotated, no compromise was reported, and the published bytes still hash to the manifest digest. Which explanation fits the evidence?
MCQ-14A service issues password-reset tokens with Python's `random.getrandbits(128)`, hex-encoded. The generator is seeded once at process start from `os.urandom`, and the same stream serves every account. An attacker can request resets for their own account as often as they like. What can the attacker do?
MCQ-15A protocol derives a per-session secret from ECDH and uses those same 32 bytes as both the AES-256-GCM content key and the HMAC-SHA-256 tag key. The team argues this is safe because AES and HMAC are different algorithms. A reviewer requires HKDF-Expand with a distinct info string per purpose instead. Which failure does that requirement actually prevent?
MCQ-1A service issues 2 million API keys, each 32 random bytes. Every request presents a key and must resolve to an account in under 5 ms, so the lookup has to be a single indexed equality match on a value derived from the presented key, and a leaked copy of the table must not let an attacker recover another account's key. The team's first design stores AES-256-GCM ciphertext of each key in the indexed column, encrypting under a KMS key with a fresh random 96-bit nonce per row. In staging, every lookup misses, even for keys issued seconds earlier. What should the indexed column hold instead?
MCQ-24A payments team publishes one Kafka event per order to a topic retained for 30 days, and each event carries the customer's full 16-digit PAN. Five consumer services read the topic. Fraud analytics must flag card-testing, many small orders placed with the same card across different merchants, so it needs one identifier per card that is identical for every event from that card over the full 30 days and matches the same field in the batch warehouse. No consumer needs the PAN itself. Which change to the event payload should the team make?
MCQ-9A breach dumps the users table: 2 million rows, each storing `sha256(password)`. An auditor finds that a precomputed table of the 200 million most common passwords recovered 60% of the accounts in under a day, and that the 2 million rows hold only 1.1 million distinct digests, so cracking one account exposes every other account that chose the same password. Which single change fixes both findings?
MCQ-8An authentication service runs on 16 cores. At bcrypt cost 10, one password verification costs 50 ms of CPU, and the service peaks at 200 logins/s. The team raises the cost to 12 to match current guidance, and makes no other change. What is the immediate effect at peak load?
MCQ-10A service stores 1,000 passwords as bcrypt(cost=12) over HMAC-SHA256(pepper, password), with a unique 16-byte salt per user. The 32-byte pepper is read from an environment variable. A CI misconfiguration leaks the pepper, and a separate SQL injection dumps the users table. The attacker has a 10^7-entry wordlist and a rig that computes 10^3 bcrypt-12 hashes per second. Every user's password is in the wordlist. Roughly how long does the attacker need to recover all 1,000 passwords?
MCQ-19A client connects to https://api.example.com using default TLS verification. The server presents a certificate with SAN DNS:api.example.net. The client's trust store contains the issuing CA. The certificate's validity period covers the current date. The server does not request a client certificate. The server signs the handshake with the private key matching the certificate's public key. The handshake fails. Which conclusion is best supported?
MCQ-22A Go 1.22 service dials `https://api.eu.example.com` with `tls.Config{ServerName: "api.eu.example.com"}` and default verification. The server presents a chain that validates to a trusted root, is unexpired, and carries exactly one SAN: `DNS:*.example.com`. What happens on this connection?
MCQ-21A payments service terminates TLS 1.2 with an RSA-2048 certificate. An attacker records a year of handshakes and application data, then obtains a copy of the server's private key. Which property of the deployment determines whether the attacker can decrypt those recordings?
MCQ-20A service mesh runs TLS 1.3, issues every workload a client certificate from one internal CA valid for 24 hours, and has no revocation endpoint. Every service validates peers against that CA's bundle. At 09:00 an attacker copies the private key file of the `refund-worker` workload's certificate out of a compromised container. Which outcome should the team expect?
MCQ-23A team's service runs on cloud instances whose disks are encrypted with a KMS key. The service persists nothing on the instance: all durable state goes to a managed database. A red team reports five findings. Which finding does the disk encryption actually mitigate?
MCQ-16A service stores 5,000 tenants' data in one object store, 40 TB in total. Each tenant has one AES-256 data key, and all 5,000 data keys are wrapped by a single KEK held in an HSM; each tenant's wrapped data key is stored alongside its data. An audit finds the KEK was exported from the HSM three weeks ago and cannot be trusted. What must the team do?
MCQ-18A payments service stores 400M records. Each record carries a `key_version` field and a data key wrapped under that master key version; the read path unwraps with the version in the header, so v7 and v8 can be read side by side. Payloads are written once and sit under a 7-year retention lock that rejects overwrites. Compliance requires master key version 7 to be destroyed 30 days after v8 becomes active for writes. 62% of the records have not been written in the last 12 months. Re-wrapping one record's data key costs 0.05 ms of CPU and the sweep pool has 8 workers. The team's plan is to activate v8 for writes, keep v7 readable, and re-wrap each record's data key the next time that record is written. What should the team do instead?