diff --git a/pg/src/main/java/org/bouncycastle/openpgp/operator/AbstractPublicKeyDataDecryptorFactory.java b/pg/src/main/java/org/bouncycastle/openpgp/operator/AbstractPublicKeyDataDecryptorFactory.java index 6d9136a72f..1646a90ea2 100644 --- a/pg/src/main/java/org/bouncycastle/openpgp/operator/AbstractPublicKeyDataDecryptorFactory.java +++ b/pg/src/main/java/org/bouncycastle/openpgp/operator/AbstractPublicKeyDataDecryptorFactory.java @@ -13,6 +13,15 @@ public abstract class AbstractPublicKeyDataDecryptorFactory implements PublicKeyDataDecryptorFactory { + @Override + public final byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData) + throws PGPException + { + byte[] sessionData = recoverSessionData(pkesk.getAlgorithm(), pkesk.getEncSessionKey(), pkesk.getVersion()); + return prependSKAlgorithmToSessionData(pkesk, encData, sessionData); + } + + protected byte[] prependSKAlgorithmToSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData, byte[] decryptedSessionData) diff --git a/pg/src/main/java/org/bouncycastle/openpgp/operator/bc/BcPublicKeyDataDecryptorFactory.java b/pg/src/main/java/org/bouncycastle/openpgp/operator/bc/BcPublicKeyDataDecryptorFactory.java index 89554b97d1..34fd865b53 100644 --- a/pg/src/main/java/org/bouncycastle/openpgp/operator/bc/BcPublicKeyDataDecryptorFactory.java +++ b/pg/src/main/java/org/bouncycastle/openpgp/operator/bc/BcPublicKeyDataDecryptorFactory.java @@ -55,13 +55,6 @@ public BcPublicKeyDataDecryptorFactory(PGPPrivateKey pgpPrivKey) this.pgpPrivKey = pgpPrivKey; } - public byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData) - throws PGPException - { - byte[] sessionData = recoverSessionData(pkesk.getAlgorithm(), pkesk.getEncSessionKey(), pkesk.getVersion()); - return prependSKAlgorithmToSessionData(pkesk, encData, sessionData); - } - @Override public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws PGPException diff --git a/pg/src/main/java/org/bouncycastle/openpgp/operator/jcajce/JcePublicKeyDataDecryptorFactoryBuilder.java b/pg/src/main/java/org/bouncycastle/openpgp/operator/jcajce/JcePublicKeyDataDecryptorFactoryBuilder.java index 5acffaa985..646e84b7c1 100644 --- a/pg/src/main/java/org/bouncycastle/openpgp/operator/jcajce/JcePublicKeyDataDecryptorFactoryBuilder.java +++ b/pg/src/main/java/org/bouncycastle/openpgp/operator/jcajce/JcePublicKeyDataDecryptorFactoryBuilder.java @@ -25,9 +25,7 @@ import org.bouncycastle.asn1.x9.X9ECParametersHolder; import org.bouncycastle.bcpg.AEADEncDataPacket; import org.bouncycastle.bcpg.ECDHPublicBCPGKey; -import org.bouncycastle.bcpg.InputStreamPacket; import org.bouncycastle.bcpg.PublicKeyAlgorithmTags; -import org.bouncycastle.bcpg.PublicKeyEncSessionPacket; import org.bouncycastle.bcpg.PublicKeyPacket; import org.bouncycastle.bcpg.SymmetricEncIntegrityPacket; import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags; @@ -135,14 +133,6 @@ public PublicKeyDataDecryptorFactory build(final PrivateKey privKey) { final int expectedPayLoadSize = getExpectedPayloadSize(privKey); - @Override - public byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData) - throws PGPException - { - byte[] sessionData = recoverSessionData(pkesk.getAlgorithm(), pkesk.getEncSessionKey(), pkesk.getVersion()); - return prependSKAlgorithmToSessionData(pkesk, encData, sessionData); - } - @Override public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws PGPException @@ -184,14 +174,6 @@ public PublicKeyDataDecryptorFactory build(final PGPPrivateKey privKey) { return new AbstractPublicKeyDataDecryptorFactory() { - @Override - public byte[] recoverSessionData(PublicKeyEncSessionPacket pkesk, InputStreamPacket encData) - throws PGPException - { - byte[] sessionData = recoverSessionData(pkesk.getAlgorithm(), pkesk.getEncSessionKey(), pkesk.getVersion()); - return prependSKAlgorithmToSessionData(pkesk, encData, sessionData); - } - @Override public byte[] recoverSessionData(int keyAlgorithm, byte[][] secKeyData, int pkeskVersion) throws PGPException