From d5e4519b97afa22c9fd0fda281e0a479cb2eb511 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 25 Jun 2018 14:52:17 +0200 Subject: [PATCH] use included bouncycastle when android-32+ has crippled version closes #2338 --- app/src/main/java/org/fdroid/fdroid/FDroidApp.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/org/fdroid/fdroid/FDroidApp.java b/app/src/main/java/org/fdroid/fdroid/FDroidApp.java index e30fb12aa..a323e4780 100644 --- a/app/src/main/java/org/fdroid/fdroid/FDroidApp.java +++ b/app/src/main/java/org/fdroid/fdroid/FDroidApp.java @@ -212,7 +212,16 @@ public class FDroidApp extends Application implements androidx.work.Configuratio } } + /** + * The built-in BouncyCastle was stripped down in {@link Build.VERSION_CODES#S} + * so that {@code SHA1withRSA} and {@code SHA256withRSA} are no longer included. + * + * @see Nearby Swap Crash on Android 12: no such algorithm: SHA1WITHRSA for provider BC + */ public static void enableBouncyCastle() { + if (Build.VERSION.SDK_INT >= 31) { + Security.removeProvider("BC"); + } Security.addProvider(BOUNCYCASTLE_PROVIDER); }