use included bouncycastle when android-32+ has crippled version

closes #2338
This commit is contained in:
Hans-Christoph Steiner
2018-06-25 14:52:17 +02:00
parent 262aaf0c4e
commit d5e4519b97

View File

@@ -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 <a href="https://gitlab.com/fdroid/fdroidclient/-/issues/2338">Nearby Swap Crash on Android 12: no such algorithm: SHA1WITHRSA for provider BC</a>
*/
public static void enableBouncyCastle() {
if (Build.VERSION.SDK_INT >= 31) {
Security.removeProvider("BC");
}
Security.addProvider(BOUNCYCASTLE_PROVIDER);
}