mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
Remove probably buggy, unused code
This commit is contained in:
parent
bd418299b0
commit
cce0605ac3
3 changed files with 0 additions and 35 deletions
|
@ -139,11 +139,6 @@ public class BcImplementationFactory extends ImplementationFactory {
|
|||
return new BcPGPKeyPair(algorithm.getAlgorithmId(), jceToBcKeyPair(algorithm, keyPair, creationDate), creationDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PGPKeyPair getPGPKeyPair(PublicKeyAlgorithm algorithm, AsymmetricCipherKeyPair keyPair, Date creationDate) throws PGPException {
|
||||
return new BcPGPKeyPair(algorithm.getAlgorithmId(), keyPair, creationDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm encryptionAlgorithm, HashAlgorithm hashAlgorithm, int s2kCount, Passphrase passphrase) throws PGPException {
|
||||
return new BcPBESecretKeyEncryptorBuilder(
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
*/
|
||||
package org.pgpainless.implementation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyPair;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPKeyPair;
|
||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||
|
@ -112,9 +108,6 @@ public abstract class ImplementationFactory {
|
|||
|
||||
public abstract PGPKeyPair getPGPKeyPair(PublicKeyAlgorithm algorithm, KeyPair keyPair, Date creationDate) throws PGPException;
|
||||
|
||||
public abstract PGPKeyPair getPGPKeyPair(PublicKeyAlgorithm algorithm, AsymmetricCipherKeyPair keyPair, Date creationDate)
|
||||
throws PGPException, NoSuchAlgorithmException, IOException, InvalidKeySpecException;
|
||||
|
||||
public abstract PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm encryptionAlgorithm,
|
||||
HashAlgorithm hashAlgorithm, int s2kCount,
|
||||
Passphrase passphrase) throws PGPException;
|
||||
|
|
|
@ -15,18 +15,9 @@
|
|||
*/
|
||||
package org.pgpainless.implementation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Date;
|
||||
|
||||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
|
||||
import org.bouncycastle.crypto.util.PrivateKeyInfoFactory;
|
||||
import org.bouncycastle.crypto.util.SubjectPublicKeyInfoFactory;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPKeyPair;
|
||||
import org.bouncycastle.openpgp.PGPPrivateKey;
|
||||
|
@ -136,10 +127,6 @@ public class JceImplementationFactory extends ImplementationFactory {
|
|||
return new JcaPGPKeyPair(algorithm.getAlgorithmId(), keyPair, creationDate);
|
||||
}
|
||||
|
||||
public PGPKeyPair getPGPKeyPair(PublicKeyAlgorithm algorithm, AsymmetricCipherKeyPair keyPair, Date creationDate) throws PGPException, NoSuchAlgorithmException, IOException, InvalidKeySpecException {
|
||||
return new JcaPGPKeyPair(algorithm.getAlgorithmId(), bcToJceKeyPair(keyPair), creationDate);
|
||||
}
|
||||
|
||||
public PBESecretKeyEncryptor getPBESecretKeyEncryptor(SymmetricKeyAlgorithm encryptionAlgorithm, HashAlgorithm hashAlgorithm, int s2kCount, Passphrase passphrase) throws PGPException {
|
||||
return new JcePBESecretKeyEncryptorBuilder(
|
||||
encryptionAlgorithm.getAlgorithmId(),
|
||||
|
@ -148,14 +135,4 @@ public class JceImplementationFactory extends ImplementationFactory {
|
|||
.setProvider(ProviderFactory.getProvider())
|
||||
.build(passphrase.getChars());
|
||||
}
|
||||
|
||||
private KeyPair bcToJceKeyPair(AsymmetricCipherKeyPair keyPair)
|
||||
throws NoSuchAlgorithmException, InvalidKeySpecException, IOException {
|
||||
byte[] pkcs8Encoded = PrivateKeyInfoFactory.createPrivateKeyInfo(keyPair.getPrivate()).getEncoded();
|
||||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(pkcs8Encoded);
|
||||
byte[] spkiEncoded = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(keyPair.getPublic()).getEncoded();
|
||||
X509EncodedKeySpec spkiKeySpec = new X509EncodedKeySpec(spkiEncoded);
|
||||
KeyFactory keyFac = KeyFactory.getInstance("RSA");
|
||||
return new KeyPair(keyFac.generatePublic(spkiKeySpec), keyFac.generatePrivate(pkcs8KeySpec));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue