From 06da4a757f8e50eb30efd4808b86d00327b474e0 Mon Sep 17 00:00:00 2001 From: Brian Demers Date: Tue, 4 May 2021 15:55:23 -0400 Subject: [PATCH] Correct padding of streaming cipher for Java 14 Update groovy version (uses an ASM version that supports java 14) Pre Java 14 "AES/GCM/PKCS5Padding" was basically an alias to "AES/GCM/NoPadding" this is no longer the case https://www.oracle.com/java/technologies/javase/14-relnote-issues.html#JDK-8180392 back-port: #231 --- .../main/java/org/apache/shiro/crypto/AesCipherService.java | 4 ++++ pom.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/cipher/src/main/java/org/apache/shiro/crypto/AesCipherService.java b/crypto/cipher/src/main/java/org/apache/shiro/crypto/AesCipherService.java index 435b998fc7..4f41e1e739 100644 --- a/crypto/cipher/src/main/java/org/apache/shiro/crypto/AesCipherService.java +++ b/crypto/cipher/src/main/java/org/apache/shiro/crypto/AesCipherService.java @@ -89,12 +89,16 @@ public class AesCipherService extends DefaultBlockCipherService { * **Since {@code GCM} is a stream cipher, padding is implemented in the operation mode and an external padding scheme * cannot be used in conjunction with {@code GCM}. In fact, {@code AES/GCM/PKCS5Padding} is just an alias in most JVM for * {@code AES/GCM/NoPadding}. + *

+ * NOTE: As of Java 14, setting a streaming padding for the above example will throw a NoSuchAlgorithmException + * @see JDK-8180392 */ public AesCipherService() { super(ALGORITHM_NAME); setMode(OperationMode.GCM); setStreamingMode(OperationMode.GCM); setPaddingScheme(PaddingScheme.NONE); + setStreamingPaddingScheme(PaddingScheme.NONE); } @Override diff --git a/pom.xml b/pom.xml index 4fcc52a1e0..4904cd23c8 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ 4.1 1.8.0 - 2.5.8 + 2.5.14 4.12 0.11.0 5.4.3.Final