Skip to content

Commit ce47baa

Browse files
committed
rm bc encryption provider
1 parent 2cd258d commit ce47baa

File tree

1 file changed

+4
-12
lines changed
  • benchmarks/src/main/java/io/aiven/kafka/tieredstorage/benchs/transform

1 file changed

+4
-12
lines changed

benchmarks/src/main/java/io/aiven/kafka/tieredstorage/benchs/transform/AesKeyAware.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,20 @@
1818

1919
import javax.crypto.Cipher;
2020
import javax.crypto.NoSuchPaddingException;
21-
import javax.crypto.spec.IvParameterSpec;
21+
import javax.crypto.spec.GCMParameterSpec;
2222
import javax.crypto.spec.SecretKeySpec;
2323

2424
import java.security.InvalidAlgorithmParameterException;
2525
import java.security.InvalidKeyException;
2626
import java.security.NoSuchAlgorithmException;
27-
import java.security.NoSuchProviderException;
2827
import java.security.SecureRandom;
29-
import java.security.Security;
3028
import java.util.Random;
3129

32-
import org.bouncycastle.jce.provider.BouncyCastleProvider;
33-
3430
public class AesKeyAware {
3531
protected static int ivSize;
3632
protected static SecretKeySpec secretKey;
3733
protected static byte[] aad;
3834

39-
static {
40-
Security.addProvider(new BouncyCastleProvider());
41-
}
42-
4335
static void initCrypto() {
4436
// These are tests, we don't need a secure source of randomness.
4537
final Random random = new Random();
@@ -69,7 +61,7 @@ protected static Cipher decryptionCipherSupplier(final byte[] encryptedChunk) {
6961
try {
7062
final Cipher encryptCipher = getCipher();
7163
encryptCipher.init(Cipher.DECRYPT_MODE, secretKey,
72-
new IvParameterSpec(encryptedChunk, 0, ivSize),
64+
new GCMParameterSpec(128, encryptedChunk, 0, ivSize),
7365
SecureRandom.getInstanceStrong());
7466
encryptCipher.updateAAD(aad);
7567
return encryptCipher;
@@ -80,8 +72,8 @@ protected static Cipher decryptionCipherSupplier(final byte[] encryptedChunk) {
8072

8173
protected static Cipher getCipher() {
8274
try {
83-
return Cipher.getInstance("AES/GCM/NoPadding", "BC");
84-
} catch (final NoSuchAlgorithmException | NoSuchProviderException | NoSuchPaddingException e) {
75+
return Cipher.getInstance("AES/GCM/NoPadding");
76+
} catch (final NoSuchAlgorithmException | NoSuchPaddingException e) {
8577
throw new RuntimeException(e);
8678
}
8779
}

0 commit comments

Comments
 (0)