Skip to content

Commit

Permalink
Correct padding of streaming cipher for Java 14
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bdemers committed May 4, 2021
1 parent b49d64a commit 06da4a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,16 @@ public class AesCipherService extends DefaultBlockCipherService {
* <b>**</b>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}.
* <p/>
* <b>NOTE:</b> As of Java 14, setting a streaming padding for the above example will throw a NoSuchAlgorithmException
* @see <a href="https://www.oracle.com/java/technologies/javase/14-relnote-issues.html#JDK-8180392">JDK-8180392</a>
*/
public AesCipherService() {
super(ALGORITHM_NAME);
setMode(OperationMode.GCM);
setStreamingMode(OperationMode.GCM);
setPaddingScheme(PaddingScheme.NONE);
setStreamingPaddingScheme(PaddingScheme.NONE);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<!-- Test 3rd-party dependencies: -->
<easymock.version>4.1</easymock.version>
<gmaven.version>1.8.0</gmaven.version>
<groovy.version>2.5.8</groovy.version>
<groovy.version>2.5.14</groovy.version>
<junit.version>4.12</junit.version>
<junit.server.jetty.version>0.11.0</junit.server.jetty.version>
<hibernate.version>5.4.3.Final</hibernate.version>
Expand Down

0 comments on commit 06da4a7

Please sign in to comment.