Skip to content

Commit 6352c16

Browse files
review comments are fixed
1 parent f4543ae commit 6352c16

File tree

1 file changed

+3
-0
lines changed
  • src/main/java/com/mastercard/developer/encryption/aes

1 file changed

+3
-0
lines changed

src/main/java/com/mastercard/developer/encryption/aes/AESCBC.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ private AESCBC() {
2828
public static byte[] decrypt(Key secretKey, JweObject object, boolean enableHmacVerification) throws GeneralSecurityException, EncryptionException {
2929
byte[] cek = secretKey.getEncoded();
3030

31+
if(cek.length != 32) {
32+
throw new IllegalArgumentException("CEK should be of length 32")
33+
}
3134
// For A128CBC-HS256: First 16 bytes are HMAC key, second 16 bytes are AES key
3235
int keyLength = cek.length / 2;
3336
SecretKeySpec aesKey = new SecretKeySpec(cek, keyLength, keyLength, "AES");

0 commit comments

Comments
 (0)