Update EncryptedContactStore to not use deprecated/removed methods
The PGPEncryptedDataGenerator constructor and addMethod calls used in EncryptedContactStore were deprecated in version 1.49 and removed in version 1.51 of Bouncycastle. Update the calls to use the recommended non-deprecated versions. Change-Id: I134fd8c0b4538ae23a2c17dd0a632ddaff28aa3d
This commit is contained in:
@@ -38,6 +38,8 @@ import org.bouncycastle.openpgp.PGPPublicKey;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
||||
import org.bouncycastle.openpgp.PGPUtil;
|
||||
import org.bouncycastle.openpgp.operator.bc.BcPGPDataEncryptorBuilder;
|
||||
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -167,12 +169,16 @@ class EncryptedContactStore implements ContactStore {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private final PGPEncryptedDataGenerator cpk()
|
||||
throws NoSuchProviderException, PGPException {
|
||||
final BcPGPDataEncryptorBuilder builder =
|
||||
new BcPGPDataEncryptorBuilder(PGPEncryptedData.CAST5)
|
||||
.setSecureRandom(prng);
|
||||
PGPEncryptedDataGenerator cpk =
|
||||
new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, true, prng, "BC");
|
||||
cpk.addMethod(dest);
|
||||
new PGPEncryptedDataGenerator(builder, true);
|
||||
final BcPublicKeyKeyEncryptionMethodGenerator methodGenerator =
|
||||
new BcPublicKeyKeyEncryptionMethodGenerator(dest);
|
||||
cpk.addMethod(methodGenerator);
|
||||
return cpk;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user