mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-04 19:45:59 +01:00
Replace JcaPGPObjectFactory with custom PGPObjectFactory.
Workaround for https://github.com/bcgit/bc-java/issues/1428
This commit is contained in:
parent
56cb9ba3c6
commit
82cea93e7b
2 changed files with 11 additions and 9 deletions
|
@ -15,7 +15,6 @@ import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
import org.bouncycastle.openpgp.PGPSecretKey;
|
||||||
import org.bouncycastle.openpgp.PGPSessionKey;
|
import org.bouncycastle.openpgp.PGPSessionKey;
|
||||||
import org.bouncycastle.openpgp.jcajce.JcaPGPObjectFactory;
|
|
||||||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||||
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
||||||
import org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator;
|
import org.bouncycastle.openpgp.operator.PBEKeyEncryptionMethodGenerator;
|
||||||
|
@ -139,11 +138,11 @@ public class JceImplementationFactory extends ImplementationFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PGPObjectFactory getPGPObjectFactory(InputStream inputStream) {
|
public PGPObjectFactory getPGPObjectFactory(InputStream inputStream) {
|
||||||
return new JcaPGPObjectFactory(inputStream);
|
return new PGPObjectFactory(inputStream, ImplementationFactory.getInstance().getKeyFingerprintCalculator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PGPObjectFactory getPGPObjectFactory(byte[] bytes) {
|
public PGPObjectFactory getPGPObjectFactory(byte[] bytes) {
|
||||||
return new JcaPGPObjectFactory(bytes);
|
return new PGPObjectFactory(bytes, ImplementationFactory.getInstance().getKeyFingerprintCalculator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
|
|
||||||
package org.pgpainless.key;
|
package org.pgpainless.key;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.TestTemplate;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.pgpainless.PGPainless;
|
import org.pgpainless.PGPainless;
|
||||||
|
import org.pgpainless.util.TestAllImplementations;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class V6OpenPgpKeyTest {
|
public class V6OpenPgpKeyTest {
|
||||||
|
|
||||||
|
@ -43,12 +44,14 @@ public class V6OpenPgpKeyTest {
|
||||||
"I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUrk0mXubZvyl4GBg==\n" +
|
"I8kWVkXU6vFOi+HWvv/ira7ofJu16NnoUkhclkUrk0mXubZvyl4GBg==\n" +
|
||||||
"-----END PGP PUBLIC KEY BLOCK-----";
|
"-----END PGP PUBLIC KEY BLOCK-----";
|
||||||
|
|
||||||
@Test
|
@TestTemplate
|
||||||
|
@ExtendWith(TestAllImplementations.class)
|
||||||
public void testParseCert() throws IOException {
|
public void testParseCert() throws IOException {
|
||||||
PGPPublicKeyRing cert = PGPainless.readKeyRing().publicKeyRing(CERT);
|
PGPPublicKeyRing cert = PGPainless.readKeyRing().publicKeyRing(CERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@TestTemplate
|
||||||
|
@ExtendWith(TestAllImplementations.class)
|
||||||
public void testParseKey() throws IOException {
|
public void testParseKey() throws IOException {
|
||||||
PGPSecretKeyRing key = PGPainless.readKeyRing().secretKeyRing(KEY);
|
PGPSecretKeyRing key = PGPainless.readKeyRing().secretKeyRing(KEY);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue