You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Adapter class between BouncyCastle's {@link BlockCipher} and JCE's {@link Cipher} API.
27
-
*
28
+
*
28
29
* <p>
29
30
* As per contract of {@link BlockCipher#processBlock(byte[], int, byte[], int)}, this class is designed to encrypt or decrypt just <b>one single block</b> at a time.
30
31
* JCE doesn't allow us to retrieve the plain cipher without a mode, so we explicitly request {@value #SINGLE_BLOCK_PLAIN_AES_JCE_CIPHER_NAME}.
31
32
* This is by design, because we want the plain cipher for a single 128 bit block without any mode. We're not actually using ECB mode.
32
-
*
33
+
*
33
34
* <p>
34
35
* This is a package-private class only used to encrypt the 128 bit counter during SIV mode.
35
36
*/
@@ -43,9 +44,17 @@ final class JceAesBlockCipher implements BlockCipher {
43
44
privateKeykey;
44
45
privateintopmode;
45
46
46
-
publicJceAesBlockCipher() {
47
+
JceAesBlockCipher() {
48
+
this(null);
49
+
}
50
+
51
+
JceAesBlockCipher(Providerprovider) {
47
52
try {
48
-
this.cipher = Cipher.getInstance(SINGLE_BLOCK_PLAIN_AES_JCE_CIPHER_NAME); // defaults to SunJCE but allows to configure different providers
0 commit comments