|
|
@@ -26,7 +26,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
|
|
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
|
|
import org.bouncycastle.bcpg.BCPGOutputStream;
|
|
|
import org.bouncycastle.bcpg.HashAlgorithmTags;
|
|
|
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
|
+import org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider;
|
|
|
import org.bouncycastle.openpgp.PGPEncryptedData;
|
|
|
import org.bouncycastle.openpgp.PGPException;
|
|
|
import org.bouncycastle.openpgp.PGPKeyPair;
|
|
|
@@ -36,11 +36,10 @@ import org.bouncycastle.openpgp.PGPSecretKey;
|
|
|
import org.bouncycastle.openpgp.PGPSignature;
|
|
|
import org.bouncycastle.openpgp.PGPSignatureGenerator;
|
|
|
import org.bouncycastle.openpgp.operator.PGPDigestCalculator;
|
|
|
-import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder;
|
|
|
-import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
|
|
|
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
|
|
|
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPDigestCalculatorProviderBuilder;
|
|
|
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyPair;
|
|
|
+import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
|
|
|
import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
|
|
|
import org.elasticsearch.Build;
|
|
|
import org.elasticsearch.Version;
|
|
|
@@ -61,7 +60,6 @@ import org.elasticsearch.test.ESTestCase;
|
|
|
import org.elasticsearch.test.PosixPermissionsResetter;
|
|
|
import org.junit.After;
|
|
|
import org.junit.Before;
|
|
|
-import org.junit.BeforeClass;
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
@@ -141,11 +139,6 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
System.setProperty("java.io.tmpdir", temp.apply("tmpdir").toString());
|
|
|
}
|
|
|
|
|
|
- @BeforeClass
|
|
|
- public static void testIfFipsMode() {
|
|
|
- assumeFalse("Can't run in a FIPS JVM because this depends on BouncyCastle (non-fips)", inFipsJvm());
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
@Before
|
|
|
public void setUp() throws Exception {
|
|
|
@@ -1174,9 +1167,9 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
sha1Calc,
|
|
|
null,
|
|
|
null,
|
|
|
- new JcaPGPContentSignerBuilder(pkp.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA1),
|
|
|
- new JcePBESecretKeyEncryptorBuilder(PGPEncryptedData.CAST5, sha1Calc)
|
|
|
- .setProvider(new BouncyCastleProvider())
|
|
|
+ new JcaPGPContentSignerBuilder(pkp.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA256),
|
|
|
+ new JcePBESecretKeyEncryptorBuilder(PGPEncryptedData.AES_192, sha1Calc)
|
|
|
+ .setProvider(new BouncyCastleFipsProvider())
|
|
|
.build("passphrase".toCharArray()));
|
|
|
}
|
|
|
|
|
|
@@ -1197,11 +1190,11 @@ public class InstallPluginCommandTests extends ESTestCase {
|
|
|
try {
|
|
|
final PGPPrivateKey privateKey
|
|
|
= secretKey.extractPrivateKey(
|
|
|
- new BcPBESecretKeyDecryptorBuilder(
|
|
|
+ new JcePBESecretKeyDecryptorBuilder(
|
|
|
new JcaPGPDigestCalculatorProviderBuilder().build()).build("passphrase".toCharArray()));
|
|
|
final PGPSignatureGenerator generator =
|
|
|
new PGPSignatureGenerator(
|
|
|
- new BcPGPContentSignerBuilder(privateKey.getPublicKeyPacket().getAlgorithm(), HashAlgorithmTags.SHA512));
|
|
|
+ new JcaPGPContentSignerBuilder(privateKey.getPublicKeyPacket().getAlgorithm(), HashAlgorithmTags.SHA512));
|
|
|
generator.init(PGPSignature.BINARY_DOCUMENT, privateKey);
|
|
|
final ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
try (BCPGOutputStream pout = new BCPGOutputStream(new ArmoredOutputStream(output));
|