From 9261d6485ec020952a8791726196adfe72246f47 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 14 Feb 2021 17:39:05 +0100 Subject: [PATCH] [openpgp] Do not put the BouncyCastleProvider at first position This causes java.security.InvalidKeyException: cannot identify XDH private key on Java 11 or higher. See also - https://github.com/bcgit/bc-java/issues/620 - https://github.com/bcgit/bc-java/issues/589 - https://github.com/corretto/corretto-11/issues/168 - https://bugs.openjdk.java.net/browse/JDK-8171279 --- .../smackx/ox/util/OpenPgpInitializer.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpInitializer.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpInitializer.java index ce723a3a4..abeaf6553 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpInitializer.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpInitializer.java @@ -17,23 +17,15 @@ package org.jivesoftware.smackx.ox.util; import org.jivesoftware.smack.initializer.UrlInitializer; -import org.jivesoftware.smack.util.SecurityUtil; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; /** * Initializer class which registers ExtensionElementProviders on startup. */ public class OpenPgpInitializer extends UrlInitializer { - static { - // Remove any BC providers and add a fresh one. - // This is done, since older Android versions ship with a crippled BC provider. - SecurityUtil.ensureProviderAtFirstPosition(BouncyCastleProvider.class); - } - @Override protected String getProvidersUri() { return "classpath:org.jivesoftware.smackx.ox/openpgp.providers"; } + }