Code Room
Code reviewHardcr-g031
Subject Crypto misuseLevel Senior–Staff~30 minCommon in Security interviewsIndustries Software development

Question

Review this Java field-encryption helper for PII.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
public byte[] encrypt(byte[] plaintext, SecretKey key) throws Exception {    Cipher c = Cipher.getInstance("AES");      // provider default    c.init(Cipher.ENCRYPT_MODE, key);    return c.doFinal(plaintext);} public byte[] decrypt(byte[] ct, SecretKey key) throws Exception {    Cipher c = Cipher.getInstance("AES");    c.init(Cipher.DECRYPT_MODE, key);    return c.doFinal(ct);}
Run or narrate your approach, then ask the coach.