8 lab correctness và failure
Chỉ dùng dữ liệu/key lab. Ghi runtime/provider/version, command, expected/actual và cleanup.
Lab 1 · Encoding ≠ encryption
Base64 một JSON chứa “secret”, decode không key; sau đó so với AES-GCM ciphertext. Pass: giải thích ai có thể reverse mỗi representation.
Lab 2 · SHA-256, HMAC và tampering
Hash file, sửa byte và so digest; tạo HMAC rồi thử attacker tính lại không key. Verify constant-time. Pass: phân biệt integrity fingerprint và authenticity.
Lab 3 · Password KDF benchmark
Benchmark PBKDF2/bcrypt/Argon2id theo environment; random salt mỗi record, verify đúng/sai, rehash-on-login. Failure: fast SHA-256 brute-force nhanh hơn rõ.
Lab 4 · AES-GCM tamper và nonce reuse
Encrypt với 96-bit nonce + AAD; sửa ciphertext/tag/AAD đều phải fail. Tạo controlled nonce-reuse demonstration chỉ trong lab. Pass: không trả plaintext khi tag fail.
Lab 5 · Fernet TTL và MultiFernet
Dùng Python cryptography tạo token, tamper, test TTL, rotate qua MultiFernet và decrypt bằng key set. Pass: ghi rõ timestamp visibility và retirement gate.
Lab 6 · RSA-OAEP hybrid envelope
Tạo RSA key pair; AES-GCM encrypt payload, RSA-OAEP wrap AES key. Thử direct RSA với message quá dài. Pass: envelope version/keyId/nonce/AAD/ciphertext rõ.
Lab 7 · RSA-PSS signature
Ký canonical message, verify public key; sửa message/signature/key đều fail. Failure: ký JSON có field order không canonical rồi chứng minh mismatch.
Lab 8 · Key rotation và mất key
Mô phỏng key ring v1/v2: new-write v2, dual-read, migrate, metrics rồi retire v1. Thử xóa v1 quá sớm. Pass: rollback và recovery boundary được ghi.