1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-23 03:17:58 +01:00

Use ProviderFactory instead of 'BC'

This commit is contained in:
Paul Schaub 2020-01-09 20:45:21 +01:00
parent 9a9f706e83
commit 2c816dd84c
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 5 additions and 4 deletions

View file

@ -42,6 +42,7 @@ import org.bouncycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder;
import org.bouncycastle.util.io.Streams;
import org.pgpainless.algorithm.CompressionAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.provider.ProviderFactory;
import org.pgpainless.util.Passphrase;
/**
@ -77,9 +78,9 @@ public class SymmetricEncryptorDecryptor {
new JcePGPDataEncryptorBuilder(encryptionAlgorithm.getAlgorithmId())
.setWithIntegrityPacket(true)
.setSecureRandom(new SecureRandom())
.setProvider("BC"));
.setProvider(ProviderFactory.getProvider()));
encGen.addMethod(new JcePBEKeyEncryptionMethodGenerator(password.getChars()).setProvider("BC"));
encGen.addMethod(new JcePBEKeyEncryptionMethodGenerator(password.getChars()).setProvider(ProviderFactory.getProvider()));
OutputStream encOut = encGen.open(bOut, compressedData.length);

View file

@ -17,13 +17,13 @@ package org.pgpainless;
import java.security.Security;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.BeforeClass;
import org.pgpainless.provider.ProviderFactory;
public abstract class AbstractPGPainlessTest {
@BeforeClass
public static void registerProvider() {
Security.insertProviderAt(new BouncyCastleProvider(), 1);
Security.insertProviderAt(ProviderFactory.getProvider(), 1);
}
}