Skip to content

Commit

Permalink
[SHIRO-736] default to PaddingScheme.NONE when using the stream ciphe…
Browse files Browse the repository at this point in the history
…r GCM
  • Loading branch information
bmarwell committed Jan 14, 2020
1 parent 80631e7 commit 1c2b3ff
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class AesCipherService extends DefaultBlockCipherService {
* </tr>
* <tr>
* <td>{@link #setPaddingScheme paddingScheme}</td>
* <td>{@link PaddingScheme#PKCS5 PKCS5}</td>
* <td>{@link PaddingScheme#NONE NoPadding}***</td>
* </tr>
* <tr>
* <td>{@link #setInitializationVectorSize(int) initializationVectorSize}</td>
Expand All @@ -85,11 +85,16 @@ public class AesCipherService extends DefaultBlockCipherService {
* <p/>
* <b>**</b>In conjunction with the default {@code GCM} operation mode, initialization vectors are generated by
* default to ensure strong encryption. See the {@link JcaCipherService JcaCipherService} class JavaDoc for more.
* <p/>
* <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}.
*/
public AesCipherService() {
super(ALGORITHM_NAME);
setMode(OperationMode.GCM);
setStreamingMode(OperationMode.GCM);
setPaddingScheme(PaddingScheme.NONE);
}

@Override
Expand Down

0 comments on commit 1c2b3ff

Please sign in to comment.