Try to use BCPQC where possible

This commit is contained in:
Arne 2024-09-11 12:18:07 +02:00
parent e74d1cdee9
commit 8a20d9c947
6 changed files with 132 additions and 122 deletions

View file

@ -130,6 +130,7 @@ dependencies {
implementation 'com.google.android.exoplayer:exoplayer-ui:2.19.1'
implementation 'com.google.android.exoplayer:extension-mediasession:2.19.1'
implementation 'com.github.natario1:Autocomplete:v1.1.0'
implementation group: 'org.bouncycastle', name: 'bcprov-ext-jdk18on', version: '1.78.1'
}
ext {

View file

@ -18,6 +18,7 @@ import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyException;
@ -109,9 +110,17 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
if (account == null || connectionService == null) {
throw new IllegalArgumentException("account and service cannot be null");
}
if (Security.getProvider("BC") == null) {
// this way for adding bouncycastle to android
//Security.removeProvider("BC");
// Confirm that positioning this provider at the end works for your needs!
Security.addProvider(new BouncyCastleProvider());
if (Security.getProvider("BCPQC") == null) {
Security.addProvider(new BouncyCastlePQCProvider());
}
//if (Security.getProvider("BC") == null) {
// Security.addProvider(new BouncyCastleProvider());
//}
this.mXmppConnectionService = connectionService;
this.account = account;
this.axolotlStore = new SQLiteAxolotlStore(this.account, this.mXmppConnectionService);

View file

@ -36,7 +36,7 @@ public class XmppAxolotlMessage {
private static final String KEYTYPE = "AES";
private static final String CIPHERMODE = "AES/GCM/NoPadding";
private static final String PROVIDER = "BC";
private static final String PROVIDER = "BCPQC";
private final List<XmppAxolotlSession.AxolotlKey> keys;
private final Jid from;
private final int sourceDeviceId;

View file

@ -75,7 +75,7 @@ public class ExportBackupWorker extends Worker {
public static final String KEYTYPE = "AES";
public static final String CIPHERMODE = "AES/GCM/NoPadding";
public static final String PROVIDER = "BC";
public static final String PROVIDER = "BCPQC";
public static final String MIME_TYPE = "application/vnd.conversations.backup";