1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 02:27:58 +01:00

[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
This commit is contained in:
Florian Schmaus 2021-02-14 17:39:05 +01:00
parent 86b48fbf00
commit 9261d6485e

View file

@ -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";
}
}