InterviewStack.io LogoInterviewStack.io

Symmetric Encryption and Block Ciphers Questions

Symmetric-key cryptography: block-cipher design (AES, Feistel structures), modes of operation, stream ciphers, and authenticated encryption with associated data (AEAD). Covers padding, IV/nonce handling, and the failure modes of misusing modes. Foundational for anyone building or evaluating data-at-rest and data-in-transit protection.

EasyTechnical
50 practiced

You are auditing this Python function in a code review:

python
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

def decrypt(key, iv, aad, ciphertext, tag):
    # Incorrect usage: appends tag to ciphertext and returns plaintext without explicit check
    aesgcm = AESGCM(key)
    plaintext = aesgcm.decrypt(iv, ciphertext + tag, aad)
    process_plaintext(plaintext)  # rest of application uses plaintext
    return plaintext

Identify the security and API-usage issues present, what could go wrong (including error handling and side-channel concerns), and propose a corrected implementation and safer API contract.

EasyTechnical
34 practiced

List and explain five common implementation pitfalls when using AEAD in real systems (for example: nonce reuse in GCM, verifying tag after parsing plaintext, truncated tags, improper AAD handling, non-constant-time comparisons). For each pitfall describe the practical security consequence and a mitigation.

MediumTechnical
51 practiced

Describe the cryptographic consequences of nonce or IV reuse in AEAD schemes (for example AES-GCM) when used after key establishment. Provide concrete examples of attacks (loss of confidentiality, forgery) and relate these issues back to choices made in key-derivation and nonce construction during the key-exchange design.

HardSystem Design
31 practiced

Design: Propose a secure rekeying strategy for long-lived sessions in a distributed streaming service (sessions lasting hours or days). Include KDF choices, rekeying triggers (time, bytes, messages, entropy events), rolling-key overlap for smooth transitions, message tagging with key-versioning, and how to preserve forward secrecy where possible.

MediumTechnical
34 practiced

Case study: Your product currently uses AES-CBC + HMAC-SHA256 (MAC-then-Encrypt) for messaging. You must migrate to AEAD (AES-GCM or ChaCha20-Poly1305) with minimal downtime and backward compatibility. Outline a migration plan that includes protocol negotiation, key-material migration, transitional compatibility modes, preventing downgrade attacks, and how to roll forward/out deprecated clients.

Unlock Full Question Bank

Get access to all Symmetric Encryption and Block Ciphers interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.