removed commented deprecated code

This commit is contained in:
Dominik 2012-09-08 23:36:10 +02:00
parent f5f2cbb2ea
commit 5cd51b2ad0

View File

@ -527,12 +527,6 @@ public class PGPMain {
progress.setProgress(R.string.progress_buildingMasterKeyRing, 30, 100); progress.setProgress(R.string.progress_buildingMasterKeyRing, 30, 100);
} }
// deprecated method:
// PGPKeyRingGenerator keyGen = new PGPKeyRingGenerator(PGPSignature.POSITIVE_CERTIFICATION,
// masterKeyPair, mainUserId, PGPEncryptedData.CAST5, newPassPhrase.toCharArray(),
// hashedPacketsGen.generate(), unhashedPacketsGen.generate(), new SecureRandom(),
// new BouncyCastleProvider().getName());
// define hashing and signing algos // define hashing and signing algos
PGPDigestCalculator sha1Calc = new JcaPGPDigestCalculatorProviderBuilder().build().get( PGPDigestCalculator sha1Calc = new JcaPGPDigestCalculatorProviderBuilder().build().get(
HashAlgorithmTags.SHA1); HashAlgorithmTags.SHA1);
@ -560,11 +554,6 @@ public class PGPMain {
.setProvider(BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray()); .setProvider(BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray());
PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2); PGPPrivateKey subPrivateKey = subKey.extractPrivateKey(keyDecryptor2);
// deprecated method:
// PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey.getAlgorithm(),
// subPublicKey.getKey(new BouncyCastleProvider()), subPrivateKey.getKey(),
// subPublicKey.getCreationTime());
// TODO: now used without algorithm and creation time?! // TODO: now used without algorithm and creation time?!
PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey, subPrivateKey); PGPKeyPair subKeyPair = new PGPKeyPair(subPublicKey, subPrivateKey);
@ -804,18 +793,6 @@ public class PGPMain {
return null; return null;
} }
return PGPConversionHelper.BytesToPGPSecretKeyRing(data); return PGPConversionHelper.BytesToPGPSecretKeyRing(data);
// deprecated method:
// try {
// return new PGPSecretKeyRing(data);
// } catch (IOException e) {
// // no good way to handle this, return null
// // TODO: some info?
// } catch (PGPException e) {
// // no good way to handle this, return null
// // TODO: some info?
// }
// return null;
} }
public static PGPPublicKeyRing getPublicKeyRing(long keyId) { public static PGPPublicKeyRing getPublicKeyRing(long keyId) {
@ -824,15 +801,6 @@ public class PGPMain {
return null; return null;
} }
return PGPConversionHelper.BytesToPGPPublicKeyRing(data); return PGPConversionHelper.BytesToPGPPublicKeyRing(data);
// deprecated method:
// try {
// return new PGPPublicKeyRing(data);
// } catch (IOException e) {
// // no good way to handle this, return null
// // TODO: some info?
// }
// return null;
} }
public static PGPSecretKey getSecretKey(long keyId) { public static PGPSecretKey getSecretKey(long keyId) {
@ -956,10 +924,6 @@ public class PGPMain {
PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(encryptorBuilder); PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(encryptorBuilder);
// deprecated method:
// PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(symmetricAlgorithm, true,
// new SecureRandom(), new BouncyCastleProvider());
if (encryptionKeyIds.length == 0) { if (encryptionKeyIds.length == 0) {
// symmetric encryption // symmetric encryption
Log.d(Constants.TAG, "encryptionKeyIds length is 0 -> symmetric encryption"); Log.d(Constants.TAG, "encryptionKeyIds length is 0 -> symmetric encryption");
@ -967,9 +931,6 @@ public class PGPMain {
JcePBEKeyEncryptionMethodGenerator symmetricEncryptionGenerator = new JcePBEKeyEncryptionMethodGenerator( JcePBEKeyEncryptionMethodGenerator symmetricEncryptionGenerator = new JcePBEKeyEncryptionMethodGenerator(
passPhrase.toCharArray()); passPhrase.toCharArray());
cPk.addMethod(symmetricEncryptionGenerator); cPk.addMethod(symmetricEncryptionGenerator);
// deprecated method:
// cPk.addMethod(passPhrase.toCharArray());
} }
for (int i = 0; i < encryptionKeyIds.length; ++i) { for (int i = 0; i < encryptionKeyIds.length; ++i) {
PGPPublicKey key = PGPHelper.getEncryptPublicKey(encryptionKeyIds[i]); PGPPublicKey key = PGPHelper.getEncryptPublicKey(encryptionKeyIds[i]);
@ -978,9 +939,6 @@ public class PGPMain {
JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator = new JcePublicKeyKeyEncryptionMethodGenerator( JcePublicKeyKeyEncryptionMethodGenerator pubKeyEncryptionGenerator = new JcePublicKeyKeyEncryptionMethodGenerator(
key); key);
cPk.addMethod(pubKeyEncryptionGenerator); cPk.addMethod(pubKeyEncryptionGenerator);
// deprecated method:
// cPk.addMethod(key);
} }
} }
encryptOut = cPk.open(out, new byte[1 << 16]); encryptOut = cPk.open(out, new byte[1 << 16]);
@ -1440,8 +1398,6 @@ public class PGPMain {
clear = pbe.getDataStream(decryptorFactory); clear = pbe.getDataStream(decryptorFactory);
// deprecated method:
// clear = pbe.getDataStream(passPhrase.toCharArray(), new BouncyCastleProvider());
encryptedData = pbe; encryptedData = pbe;
currentProgress += 5; currentProgress += 5;
} else { } else {
@ -1491,8 +1447,6 @@ public class PGPMain {
clear = pbe.getDataStream(decryptorFactory); clear = pbe.getDataStream(decryptorFactory);
// deprecated method:
// clear = pbe.getDataStream(privateKey, new BouncyCastleProvider());
encryptedData = pbe; encryptedData = pbe;
currentProgress += 5; currentProgress += 5;
} }
@ -1546,9 +1500,6 @@ public class PGPMain {
.setProvider(BOUNCY_CASTLE_PROVIDER_NAME); .setProvider(BOUNCY_CASTLE_PROVIDER_NAME);
signature.init(contentVerifierBuilderProvider, signatureKey); signature.init(contentVerifierBuilderProvider, signatureKey);
// deprecated method:
// signature.initVerify(signatureKey, new BouncyCastleProvider());
} else { } else {
returnData.putBoolean(ApgService.RESULT_SIGNATURE_UNKNOWN, true); returnData.putBoolean(ApgService.RESULT_SIGNATURE_UNKNOWN, true);
} }
@ -1693,19 +1644,8 @@ public class PGPMain {
returnData.putLong(ApgService.RESULT_SIGNATURE_KEY_ID, signatureKeyId); returnData.putLong(ApgService.RESULT_SIGNATURE_KEY_ID, signatureKeyId);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_LOOKUP_KEY, true); returnData.putBoolean(ApgService.RESULT_SIGNATURE_LOOKUP_KEY, true);
// return directly now, decrypt will be done again after importing unknown key
return returnData; return returnData;
// TODO: reimplement!
// Bundle pauseData = new Bundle();
// pauseData.putInt(Constants.extras.STATUS, Id.message.unknown_signature_key);
// pauseData.putLong(Constants.extras.KEY_ID, signatureKeyId);
// Message msg = new Message();
// msg.setData(pauseData);
// context.sendMessage(msg);
// // pause here
// context.getRunningThread().pause();
// // see whether the key was found in the meantime
// signatureKey = getPublicKey(signature.getKeyID());
} }
if (signatureKey == null) { if (signatureKey == null) {
@ -1736,9 +1676,6 @@ public class PGPMain {
signature.init(contentVerifierBuilderProvider, signatureKey); signature.init(contentVerifierBuilderProvider, signatureKey);
// deprecated method:
// signature.initVerify(signatureKey, new BouncyCastleProvider());
InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText)); InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText));
lookAhead = readInputLine(lineOut, sigIn); lookAhead = readInputLine(lineOut, sigIn);