Mitigate MMA attacks on JWE RSA1_5 alg

Issue #23 resolved
Vladimir Dzhuvinov created an issue

Comments (5)

  1. Justin Richer

    From Juraj:

    if (alg.equals(JWEAlgorithm.RSA1_5)) {
        int keyLength = cmkBitLength(readOnlyJWEHeader.getEncryptionMethod());
        SecretKey randomCMK = AES.generateAESCMK(keyLength);
    
        try {
            cmk = RSA1_5.decryptCMK(privateKey, encryptedKey.decode(), keyLength);
        } catch (Exception e) {
            // Protect against MMA attack by generating random CMK on failure,
            // see http://www.ietf.org/mail-archive/web/jose/current/msg01832.html
            cmk = randomCMK;
        }
    }
    
  2. Log in to comment