1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-30 08:12:06 +01:00

Further sourcing of PGPObjectFactory from ImplementationProvider

This commit is contained in:
Paul Schaub 2021-12-14 15:03:45 +01:00
parent 60f7a9d9ec
commit a66b45c3d2
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
9 changed files with 35 additions and 49 deletions

View file

@ -37,7 +37,6 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSessionKey; import org.bouncycastle.openpgp.PGPSessionKey;
import org.bouncycastle.openpgp.PGPSignature; import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPUtil; import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory; import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
import org.bouncycastle.openpgp.operator.PGPContentVerifierBuilderProvider; import org.bouncycastle.openpgp.operator.PGPContentVerifierBuilderProvider;
import org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory; import org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory;
@ -59,9 +58,9 @@ import org.pgpainless.key.SubkeyIdentifier;
import org.pgpainless.key.info.KeyRingInfo; import org.pgpainless.key.info.KeyRingInfo;
import org.pgpainless.key.protection.SecretKeyRingProtector; import org.pgpainless.key.protection.SecretKeyRingProtector;
import org.pgpainless.key.protection.UnlockSecretKey; import org.pgpainless.key.protection.UnlockSecretKey;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.signature.consumer.DetachedSignatureCheck; import org.pgpainless.signature.consumer.DetachedSignatureCheck;
import org.pgpainless.signature.consumer.OnePassSignatureCheck; import org.pgpainless.signature.consumer.OnePassSignatureCheck;
import org.pgpainless.signature.SignatureUtils;
import org.pgpainless.util.CRCingArmoredInputStreamWrapper; import org.pgpainless.util.CRCingArmoredInputStreamWrapper;
import org.pgpainless.util.PGPUtilWrapper; import org.pgpainless.util.PGPUtilWrapper;
import org.pgpainless.util.Passphrase; import org.pgpainless.util.Passphrase;
@ -85,8 +84,6 @@ public final class DecryptionStreamFactory {
private static final PGPContentVerifierBuilderProvider verifierBuilderProvider = private static final PGPContentVerifierBuilderProvider verifierBuilderProvider =
ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider(); ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider();
private static final KeyFingerPrintCalculator keyFingerprintCalculator =
ImplementationFactory.getInstance().getKeyFingerprintCalculator();
private IntegrityProtectedInputStream integrityProtectedEncryptedInputStream; private IntegrityProtectedInputStream integrityProtectedEncryptedInputStream;
@ -150,7 +147,7 @@ public final class DecryptionStreamFactory {
} }
} }
objectFactory = new PGPObjectFactory(decoderStream, keyFingerprintCalculator); objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decoderStream);
// Parse OpenPGP message // Parse OpenPGP message
inputStream = processPGPPackets(objectFactory, 1); inputStream = processPGPPackets(objectFactory, 1);
} catch (EOFException e) { } catch (EOFException e) {
@ -162,7 +159,7 @@ public final class DecryptionStreamFactory {
LOGGER.debug("The message appears to not be an OpenPGP message. This is probably data signed with detached signatures?"); LOGGER.debug("The message appears to not be an OpenPGP message. This is probably data signed with detached signatures?");
bufferedIn.reset(); bufferedIn.reset();
decoderStream = bufferedIn; decoderStream = bufferedIn;
objectFactory = new PGPObjectFactory(decoderStream, keyFingerprintCalculator); objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decoderStream);
inputStream = wrapInVerifySignatureStream(bufferedIn, objectFactory); inputStream = wrapInVerifySignatureStream(bufferedIn, objectFactory);
} catch (IOException e) { } catch (IOException e) {
if (e.getMessage().contains("invalid armor") || e.getMessage().contains("invalid header encountered")) { if (e.getMessage().contains("invalid armor") || e.getMessage().contains("invalid header encountered")) {
@ -170,7 +167,7 @@ public final class DecryptionStreamFactory {
LOGGER.debug("The message is apparently not armored."); LOGGER.debug("The message is apparently not armored.");
bufferedIn.reset(); bufferedIn.reset();
decoderStream = bufferedIn; decoderStream = bufferedIn;
objectFactory = new PGPObjectFactory(decoderStream, keyFingerprintCalculator); objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decoderStream);
inputStream = wrapInVerifySignatureStream(bufferedIn, objectFactory); inputStream = wrapInVerifySignatureStream(bufferedIn, objectFactory);
} else { } else {
throw e; throw e;
@ -219,13 +216,13 @@ public final class DecryptionStreamFactory {
if (sessionKey != null) { if (sessionKey != null) {
integrityProtectedEncryptedInputStream = decryptWithProvidedSessionKey(pgpEncryptedDataList, sessionKey); integrityProtectedEncryptedInputStream = decryptWithProvidedSessionKey(pgpEncryptedDataList, sessionKey);
InputStream decodedDataStream = PGPUtil.getDecoderStream(integrityProtectedEncryptedInputStream); InputStream decodedDataStream = PGPUtil.getDecoderStream(integrityProtectedEncryptedInputStream);
PGPObjectFactory factory = new PGPObjectFactory(decodedDataStream, keyFingerprintCalculator); PGPObjectFactory factory = ImplementationFactory.getInstance().getPGPObjectFactory(decodedDataStream);
return processPGPPackets(factory, ++depth); return processPGPPackets(factory, ++depth);
} }
InputStream decryptedDataStream = decryptSessionKey(pgpEncryptedDataList); InputStream decryptedDataStream = decryptSessionKey(pgpEncryptedDataList);
InputStream decodedDataStream = PGPUtil.getDecoderStream(decryptedDataStream); InputStream decodedDataStream = PGPUtil.getDecoderStream(decryptedDataStream);
PGPObjectFactory factory = new PGPObjectFactory(decodedDataStream, keyFingerprintCalculator); PGPObjectFactory factory = ImplementationFactory.getInstance().getPGPObjectFactory(decodedDataStream);
return processPGPPackets(factory, ++depth); return processPGPPackets(factory, ++depth);
} }
@ -269,7 +266,7 @@ public final class DecryptionStreamFactory {
InputStream inflatedDataStream = pgpCompressedData.getDataStream(); InputStream inflatedDataStream = pgpCompressedData.getDataStream();
InputStream decodedDataStream = PGPUtil.getDecoderStream(inflatedDataStream); InputStream decodedDataStream = PGPUtil.getDecoderStream(inflatedDataStream);
PGPObjectFactory objectFactory = new PGPObjectFactory(decodedDataStream, keyFingerprintCalculator); PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decodedDataStream);
return processPGPPackets(objectFactory, ++depth); return processPGPPackets(objectFactory, ++depth);
} }

View file

@ -21,7 +21,6 @@ import org.bouncycastle.openpgp.PGPOnePassSignatureList;
import org.bouncycastle.openpgp.PGPPBEEncryptedData; import org.bouncycastle.openpgp.PGPPBEEncryptedData;
import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData; import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData;
import org.bouncycastle.openpgp.PGPUtil; import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
import org.pgpainless.implementation.ImplementationFactory; import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.util.ArmorUtils; import org.pgpainless.util.ArmorUtils;
@ -101,8 +100,7 @@ public final class MessageInspector {
} }
private static void processMessage(InputStream dataIn, EncryptionInfo info) throws PGPException, IOException { private static void processMessage(InputStream dataIn, EncryptionInfo info) throws PGPException, IOException {
KeyFingerPrintCalculator calculator = ImplementationFactory.getInstance().getKeyFingerprintCalculator(); PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(dataIn);
PGPObjectFactory objectFactory = new PGPObjectFactory(dataIn, calculator);
Object next; Object next;
while ((next = objectFactory.nextObject()) != null) { while ((next = objectFactory.nextObject()) != null) {
@ -131,7 +129,8 @@ public final class MessageInspector {
if (next instanceof PGPCompressedData) { if (next instanceof PGPCompressedData) {
PGPCompressedData compressed = (PGPCompressedData) next; PGPCompressedData compressed = (PGPCompressedData) next;
InputStream decompressed = compressed.getDataStream(); InputStream decompressed = compressed.getDataStream();
objectFactory = new PGPObjectFactory(PGPUtil.getDecoderStream(decompressed), calculator); InputStream decoded = PGPUtil.getDecoderStream(decompressed);
objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decoded);
} }
if (next instanceof PGPLiteralData) { if (next instanceof PGPLiteralData) {

View file

@ -71,7 +71,7 @@ public final class ClearsignedMessageUtil {
out.close(); out.close();
} }
PGPObjectFactory objectFactory = new PGPObjectFactory(in, ImplementationFactory.getInstance().getKeyFingerprintCalculator()); PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(in);
PGPSignatureList signatures = (PGPSignatureList) objectFactory.nextObject(); PGPSignatureList signatures = (PGPSignatureList) objectFactory.nextObject();
return signatures; return signatures;

View file

@ -47,7 +47,7 @@ public class PGPKeyRingCollection {
public PGPKeyRingCollection(@Nonnull InputStream in, boolean isSilent) throws IOException, PGPException { public PGPKeyRingCollection(@Nonnull InputStream in, boolean isSilent) throws IOException, PGPException {
// Double getDecoderStream because of #96 // Double getDecoderStream because of #96
InputStream decoderStream = ArmorUtils.getDecoderStream(in); InputStream decoderStream = ArmorUtils.getDecoderStream(in);
PGPObjectFactory pgpFact = new PGPObjectFactory(decoderStream, ImplementationFactory.getInstance().getKeyFingerprintCalculator()); PGPObjectFactory pgpFact = ImplementationFactory.getInstance().getPGPObjectFactory(decoderStream);
Object obj; Object obj;
List<PGPSecretKeyRing> secretKeyRings = new ArrayList<>(); List<PGPSecretKeyRing> secretKeyRings = new ArrayList<>();

View file

@ -108,9 +108,8 @@ public class KeyRingReader {
* @return public key ring * @return public key ring
*/ */
public static PGPPublicKeyRing readPublicKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException { public static PGPPublicKeyRing readPublicKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException {
PGPObjectFactory objectFactory = new PGPObjectFactory( PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(
ArmorUtils.getDecoderStream(inputStream), ArmorUtils.getDecoderStream(inputStream));
ImplementationFactory.getInstance().getKeyFingerprintCalculator());
int i = 0; int i = 0;
Object next; Object next;
do { do {
@ -146,9 +145,8 @@ public class KeyRingReader {
*/ */
public static PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull InputStream inputStream, int maxIterations) public static PGPPublicKeyRingCollection readPublicKeyRingCollection(@Nonnull InputStream inputStream, int maxIterations)
throws IOException, PGPException { throws IOException, PGPException {
PGPObjectFactory objectFactory = new PGPObjectFactory( PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(
ArmorUtils.getDecoderStream(inputStream), ArmorUtils.getDecoderStream(inputStream));
ImplementationFactory.getInstance().getKeyFingerprintCalculator());
List<PGPPublicKeyRing> rings = new ArrayList<>(); List<PGPPublicKeyRing> rings = new ArrayList<>();
int i = 0; int i = 0;
@ -191,9 +189,7 @@ public class KeyRingReader {
*/ */
public static PGPSecretKeyRing readSecretKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException { public static PGPSecretKeyRing readSecretKeyRing(@Nonnull InputStream inputStream, int maxIterations) throws IOException {
InputStream decoderStream = ArmorUtils.getDecoderStream(inputStream); InputStream decoderStream = ArmorUtils.getDecoderStream(inputStream);
PGPObjectFactory objectFactory = new PGPObjectFactory( PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decoderStream);
decoderStream,
ImplementationFactory.getInstance().getKeyFingerprintCalculator());
int i = 0; int i = 0;
Object next; Object next;
do { do {
@ -230,9 +226,8 @@ public class KeyRingReader {
public static PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull InputStream inputStream, public static PGPSecretKeyRingCollection readSecretKeyRingCollection(@Nonnull InputStream inputStream,
int maxIterations) int maxIterations)
throws IOException, PGPException { throws IOException, PGPException {
PGPObjectFactory objectFactory = new PGPObjectFactory( PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(
ArmorUtils.getDecoderStream(inputStream), ArmorUtils.getDecoderStream(inputStream));
ImplementationFactory.getInstance().getKeyFingerprintCalculator());
List<PGPSecretKeyRing> rings = new ArrayList<>(); List<PGPSecretKeyRing> rings = new ArrayList<>();
int i = 0; int i = 0;

View file

@ -238,16 +238,14 @@ public final class SignatureUtils {
public static List<PGPSignature> readSignatures(InputStream inputStream, int maxIterations) throws IOException, PGPException { public static List<PGPSignature> readSignatures(InputStream inputStream, int maxIterations) throws IOException, PGPException {
List<PGPSignature> signatures = new ArrayList<>(); List<PGPSignature> signatures = new ArrayList<>();
InputStream pgpIn = ArmorUtils.getDecoderStream(inputStream); InputStream pgpIn = ArmorUtils.getDecoderStream(inputStream);
PGPObjectFactory objectFactory = new PGPObjectFactory( PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(pgpIn);
pgpIn, ImplementationFactory.getInstance().getKeyFingerprintCalculator());
int i = 0; int i = 0;
Object nextObject; Object nextObject;
while (i++ < maxIterations && (nextObject = objectFactory.nextObject()) != null) { while (i++ < maxIterations && (nextObject = objectFactory.nextObject()) != null) {
if (nextObject instanceof PGPCompressedData) { if (nextObject instanceof PGPCompressedData) {
PGPCompressedData compressedData = (PGPCompressedData) nextObject; PGPCompressedData compressedData = (PGPCompressedData) nextObject;
objectFactory = new PGPObjectFactory(compressedData.getDataStream(), objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(compressedData.getDataStream());
ImplementationFactory.getInstance().getKeyFingerprintCalculator());
} }
if (nextObject instanceof PGPSignatureList) { if (nextObject instanceof PGPSignatureList) {

View file

@ -18,15 +18,19 @@ import java.util.Date;
import org.bouncycastle.openpgp.PGPLiteralData; import org.bouncycastle.openpgp.PGPLiteralData;
import org.bouncycastle.openpgp.PGPLiteralDataGenerator; import org.bouncycastle.openpgp.PGPLiteralDataGenerator;
import org.bouncycastle.openpgp.PGPObjectFactory; import org.bouncycastle.openpgp.PGPObjectFactory;
import org.bouncycastle.openpgp.bc.BcPGPObjectFactory;
import org.bouncycastle.util.io.Streams; import org.bouncycastle.util.io.Streams;
import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.pgpainless.implementation.ImplementationFactory;
import org.pgpainless.util.PGPUtilWrapper; import org.pgpainless.util.PGPUtilWrapper;
public class PGPUtilWrapperTest { public class PGPUtilWrapperTest {
@Test @ParameterizedTest
public void testGetDecoderStream() throws IOException { @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories")
public void testGetDecoderStream(ImplementationFactory implementationFactory) throws IOException {
ImplementationFactory.setFactoryImplementation(implementationFactory);
ByteArrayInputStream msg = new ByteArrayInputStream("Foo\nBar".getBytes(StandardCharsets.UTF_8)); ByteArrayInputStream msg = new ByteArrayInputStream("Foo\nBar".getBytes(StandardCharsets.UTF_8));
PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator(); PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator();
@ -36,7 +40,7 @@ public class PGPUtilWrapperTest {
literalDataGenerator.close(); literalDataGenerator.close();
InputStream in = new ByteArrayInputStream(out.toByteArray()); InputStream in = new ByteArrayInputStream(out.toByteArray());
PGPObjectFactory objectFactory = new BcPGPObjectFactory(in); PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(in);
PGPLiteralData literalData = (PGPLiteralData) objectFactory.nextObject(); PGPLiteralData literalData = (PGPLiteralData) objectFactory.nextObject();
InputStream litIn = literalData.getDataStream(); InputStream litIn = literalData.getDataStream();
BufferedInputStream bufIn = new BufferedInputStream(litIn); BufferedInputStream bufIn = new BufferedInputStream(litIn);

View file

@ -19,9 +19,6 @@ import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPSecretKey; import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing; import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor; import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider;
import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder;
import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider;
import org.bouncycastle.util.io.Streams; import org.bouncycastle.util.io.Streams;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
@ -168,14 +165,12 @@ public class ChangeSecretKeyRingPassphraseTest {
* @throws PGPException if passphrase is wrong * @throws PGPException if passphrase is wrong
*/ */
private void extractPrivateKey(PGPSecretKey secretKey, Passphrase passphrase) throws PGPException { private void extractPrivateKey(PGPSecretKey secretKey, Passphrase passphrase) throws PGPException {
PGPDigestCalculatorProvider digestCalculatorProvider = new BcPGPDigestCalculatorProvider();
if (passphrase.isEmpty() && secretKey.getKeyEncryptionAlgorithm() != SymmetricKeyAlgorithm.NULL.getAlgorithmId()) { if (passphrase.isEmpty() && secretKey.getKeyEncryptionAlgorithm() != SymmetricKeyAlgorithm.NULL.getAlgorithmId()) {
throw new PGPException("Cannot unlock encrypted private key with empty passphrase."); throw new PGPException("Cannot unlock encrypted private key with empty passphrase.");
} else if (!passphrase.isEmpty() && secretKey.getKeyEncryptionAlgorithm() == SymmetricKeyAlgorithm.NULL.getAlgorithmId()) { } else if (!passphrase.isEmpty() && secretKey.getKeyEncryptionAlgorithm() == SymmetricKeyAlgorithm.NULL.getAlgorithmId()) {
throw new PGPException("Cannot unlock unprotected private key with non-empty passphrase."); throw new PGPException("Cannot unlock unprotected private key with non-empty passphrase.");
} }
PBESecretKeyDecryptor decryptor = passphrase.isEmpty() ? null : new BcPBESecretKeyDecryptorBuilder(digestCalculatorProvider) PBESecretKeyDecryptor decryptor = passphrase.isEmpty() ? null : ImplementationFactory.getInstance().getPBESecretKeyDecryptor(passphrase);
.build(passphrase.getChars());
UnlockSecretKey.unlockSecretKey(secretKey, decryptor); UnlockSecretKey.unlockSecretKey(secretKey, decryptor);
} }

View file

@ -31,9 +31,7 @@ import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSignature; import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureList; import org.bouncycastle.openpgp.PGPSignatureList;
import org.bouncycastle.openpgp.PGPUtil; import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.bc.BcPGPObjectFactory;
import org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory; import org.bouncycastle.openpgp.operator.PublicKeyDataDecryptorFactory;
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyDataDecryptorFactory;
import org.bouncycastle.util.io.Streams; import org.bouncycastle.util.io.Streams;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
@ -79,7 +77,7 @@ public class OnePassSignatureBracketingTest {
ByteArrayInputStream ciphertextIn = new ByteArrayInputStream(out.toByteArray()); ByteArrayInputStream ciphertextIn = new ByteArrayInputStream(out.toByteArray());
InputStream inputStream = PGPUtil.getDecoderStream(ciphertextIn); InputStream inputStream = PGPUtil.getDecoderStream(ciphertextIn);
PGPObjectFactory objectFactory = new BcPGPObjectFactory(inputStream); PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(inputStream);
PGPOnePassSignatureList onePassSignatures = null; PGPOnePassSignatureList onePassSignatures = null;
PGPSignatureList signatures = null; PGPSignatureList signatures = null;
@ -96,9 +94,9 @@ public class OnePassSignatureBracketingTest {
PGPPublicKeyEncryptedData publicKeyEncryptedData = (PGPPublicKeyEncryptedData) encryptedData; PGPPublicKeyEncryptedData publicKeyEncryptedData = (PGPPublicKeyEncryptedData) encryptedData;
PGPSecretKey secretKey = key1.getSecretKey(publicKeyEncryptedData.getKeyID()); PGPSecretKey secretKey = key1.getSecretKey(publicKeyEncryptedData.getKeyID());
PGPPrivateKey privateKey = UnlockSecretKey.unlockSecretKey(secretKey, SecretKeyRingProtector.unprotectedKeys()); PGPPrivateKey privateKey = UnlockSecretKey.unlockSecretKey(secretKey, SecretKeyRingProtector.unprotectedKeys());
PublicKeyDataDecryptorFactory decryptorFactory = new BcPublicKeyDataDecryptorFactory(privateKey); PublicKeyDataDecryptorFactory decryptorFactory = ImplementationFactory.getInstance().getPublicKeyDataDecryptorFactory(privateKey);
InputStream decryptionStream = publicKeyEncryptedData.getDataStream(decryptorFactory); InputStream decryptionStream = publicKeyEncryptedData.getDataStream(decryptorFactory);
objectFactory = new BcPGPObjectFactory(decryptionStream); objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decryptionStream);
continue outerloop; continue outerloop;
} }
} }
@ -108,7 +106,7 @@ public class OnePassSignatureBracketingTest {
} else if (next instanceof PGPCompressedData) { } else if (next instanceof PGPCompressedData) {
PGPCompressedData compressed = (PGPCompressedData) next; PGPCompressedData compressed = (PGPCompressedData) next;
InputStream decompressor = compressed.getDataStream(); InputStream decompressor = compressed.getDataStream();
objectFactory = new PGPObjectFactory(decompressor, ImplementationFactory.getInstance().getKeyFingerprintCalculator()); objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(decompressor);
continue outerloop; continue outerloop;
} else if (next instanceof PGPLiteralData) { } else if (next instanceof PGPLiteralData) {
continue outerloop; continue outerloop;