mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 03:17:58 +01:00
Remove unused methods from ImplementationFactory
This commit is contained in:
parent
9a4c5ec54f
commit
4be2956469
3 changed files with 0 additions and 35 deletions
|
@ -15,7 +15,6 @@ import org.bouncycastle.openpgp.PGPKeyPair;
|
||||||
import org.bouncycastle.openpgp.PGPObjectFactory;
|
import org.bouncycastle.openpgp.PGPObjectFactory;
|
||||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPSessionKey;
|
import org.bouncycastle.openpgp.PGPSessionKey;
|
||||||
import org.bouncycastle.openpgp.bc.BcPGPObjectFactory;
|
import org.bouncycastle.openpgp.bc.BcPGPObjectFactory;
|
||||||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||||
|
@ -52,23 +51,6 @@ import org.pgpainless.util.Passphrase;
|
||||||
|
|
||||||
public class BcImplementationFactory extends ImplementationFactory {
|
public class BcImplementationFactory extends ImplementationFactory {
|
||||||
|
|
||||||
@Override
|
|
||||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(PGPSecretKey secretKey, Passphrase passphrase)
|
|
||||||
throws PGPException {
|
|
||||||
int keyEncryptionAlgorithm = secretKey.getKeyEncryptionAlgorithm();
|
|
||||||
|
|
||||||
if (secretKey.getS2K() == null) {
|
|
||||||
return getPBESecretKeyEncryptor(SymmetricKeyAlgorithm.requireFromId(keyEncryptionAlgorithm), passphrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
int hashAlgorithm = secretKey.getS2K().getHashAlgorithm();
|
|
||||||
PGPDigestCalculator digestCalculator = getPGPDigestCalculator(hashAlgorithm);
|
|
||||||
long iterationCount = secretKey.getS2K().getIterationCount();
|
|
||||||
|
|
||||||
return new BcPBESecretKeyEncryptorBuilder(keyEncryptionAlgorithm, digestCalculator, (int) iterationCount)
|
|
||||||
.build(passphrase.getChars());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
|
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
|
||||||
PGPDigestCalculator digestCalculator,
|
PGPDigestCalculator digestCalculator,
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.bouncycastle.openpgp.PGPKeyPair;
|
||||||
import org.bouncycastle.openpgp.PGPObjectFactory;
|
import org.bouncycastle.openpgp.PGPObjectFactory;
|
||||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPSessionKey;
|
import org.bouncycastle.openpgp.PGPSessionKey;
|
||||||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||||
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
||||||
|
@ -49,15 +48,6 @@ public abstract class ImplementationFactory {
|
||||||
return FACTORY_IMPLEMENTATION;
|
return FACTORY_IMPLEMENTATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
|
|
||||||
Passphrase passphrase)
|
|
||||||
throws PGPException {
|
|
||||||
return getPBESecretKeyEncryptor(symmetricKeyAlgorithm,
|
|
||||||
getPGPDigestCalculator(HashAlgorithm.SHA1), passphrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract PBESecretKeyEncryptor getPBESecretKeyEncryptor(PGPSecretKey secretKey, Passphrase passphrase) throws PGPException;
|
|
||||||
|
|
||||||
public abstract PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
|
public abstract PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm,
|
||||||
PGPDigestCalculator digestCalculator,
|
PGPDigestCalculator digestCalculator,
|
||||||
Passphrase passphrase);
|
Passphrase passphrase);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.bouncycastle.openpgp.PGPKeyPair;
|
||||||
import org.bouncycastle.openpgp.PGPObjectFactory;
|
import org.bouncycastle.openpgp.PGPObjectFactory;
|
||||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKey;
|
|
||||||
import org.bouncycastle.openpgp.PGPSessionKey;
|
import org.bouncycastle.openpgp.PGPSessionKey;
|
||||||
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
import org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator;
|
||||||
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
import org.bouncycastle.openpgp.operator.PBEDataDecryptorFactory;
|
||||||
|
@ -49,12 +48,6 @@ import org.pgpainless.util.Passphrase;
|
||||||
|
|
||||||
public class JceImplementationFactory extends ImplementationFactory {
|
public class JceImplementationFactory extends ImplementationFactory {
|
||||||
|
|
||||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(PGPSecretKey secretKey, Passphrase passphrase) {
|
|
||||||
return new JcePBESecretKeyEncryptorBuilder(secretKey.getKeyEncryptionAlgorithm())
|
|
||||||
.setProvider(ProviderFactory.getProvider())
|
|
||||||
.build(passphrase.getChars());
|
|
||||||
}
|
|
||||||
|
|
||||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm, PGPDigestCalculator digestCalculator, Passphrase passphrase) {
|
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm symmetricKeyAlgorithm, PGPDigestCalculator digestCalculator, Passphrase passphrase) {
|
||||||
return new JcePBESecretKeyEncryptorBuilder(symmetricKeyAlgorithm.getAlgorithmId(), digestCalculator)
|
return new JcePBESecretKeyEncryptorBuilder(symmetricKeyAlgorithm.getAlgorithmId(), digestCalculator)
|
||||||
.setProvider(ProviderFactory.getProvider())
|
.setProvider(ProviderFactory.getProvider())
|
||||||
|
|
Loading…
Reference in a new issue