mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-10 18:59:39 +02:00
Remove ImplementationFactory in favor of BCs OpenPGPImplementation
This commit is contained in:
parent
0bc80d86d3
commit
76963ec3ec
48 changed files with 303 additions and 550 deletions
|
@ -22,10 +22,10 @@ import org.bouncycastle.openpgp.PGPObjectFactory;
|
|||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSignature;
|
||||
import org.bouncycastle.openpgp.PGPSignatureList;
|
||||
import org.bouncycastle.openpgp.api.OpenPGPImplementation;
|
||||
import org.bouncycastle.util.io.Streams;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.pgpainless.PGPainless;
|
||||
import org.pgpainless.implementation.ImplementationFactory;
|
||||
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||
import sop.ByteArrayAndResult;
|
||||
import sop.SOP;
|
||||
|
@ -153,13 +153,13 @@ public class InlineDetachTest {
|
|||
|
||||
ByteArrayOutputStream literalDataAndSignatures = new ByteArrayOutputStream();
|
||||
ArmoredInputStream armorIn = new ArmoredInputStream(new ByteArrayInputStream(inlineSigned));
|
||||
PGPObjectFactory objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(armorIn);
|
||||
PGPObjectFactory objectFactory = OpenPGPImplementation.getInstance().pgpObjectFactory(armorIn);
|
||||
Object next;
|
||||
while ((next = objectFactory.nextObject()) != null) {
|
||||
if (next instanceof PGPCompressedData) {
|
||||
PGPCompressedData compressedData = (PGPCompressedData) next;
|
||||
try {
|
||||
objectFactory = ImplementationFactory.getInstance().getPGPObjectFactory(compressedData.getDataStream());
|
||||
objectFactory = OpenPGPImplementation.getInstance().pgpObjectFactory(compressedData.getDataStream());
|
||||
} catch (PGPException e) {
|
||||
throw new SOPGPException.BadData("Cannot decompress compressed data", e);
|
||||
}
|
||||
|
|
|
@ -96,13 +96,13 @@ public class MatchMakingSecretKeyRingProtectorTest {
|
|||
MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector();
|
||||
protector.addSecretKey(unprotectedKey);
|
||||
assertTrue(protector.hasPassphraseFor(unprotectedKey.getPublicKey().getKeyID()));
|
||||
assertNull(protector.getEncryptor(unprotectedKey.getPublicKey().getKeyID()));
|
||||
assertNull(protector.getEncryptor(unprotectedKey.getPublicKey()));
|
||||
assertNull(protector.getDecryptor(unprotectedKey.getPublicKey().getKeyID()));
|
||||
|
||||
PGPSecretKeyRing protectedKey = PGPainless.readKeyRing().secretKeyRing(PROTECTED_KEY);
|
||||
protector.addSecretKey(protectedKey);
|
||||
protector.addPassphrase(Passphrase.fromPassword(PASSWORD));
|
||||
assertNotNull(protector.getEncryptor(protectedKey.getPublicKey().getKeyID()));
|
||||
assertNotNull(protector.getEncryptor(protectedKey.getPublicKey()));
|
||||
assertNotNull(protector.getDecryptor(protectedKey.getPublicKey().getKeyID()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue