Skip to content

Commit c72d002

Browse files
committed
Disable bouncycastle runtime initialization for now
1 parent 0188ae4 commit c72d002

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/BouncyCastleFeature.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@
5252
import com.oracle.graal.python.runtime.PythonImageBuildOptions;
5353

5454
public class BouncyCastleFeature implements Feature {
55+
56+
/*
57+
* Will soon be default in native image. We'll still need the old way to support older
58+
* native-image in JDK 21. I guess then it would be something like:
59+
*
60+
* INITIALIZE_AT_RUNTIME = Runtime.version().feature() >= 26;
61+
*/
62+
private static final boolean INITIALIZE_AT_RUNTIME = false;
63+
5564
@Override
5665
public void afterRegistration(AfterRegistrationAccess access) {
5766
if (!PythonImageBuildOptions.WITHOUT_SSL) {
5867
RuntimeClassInitializationSupport support = ImageSingletons.lookup(RuntimeClassInitializationSupport.class);
5968

60-
if (Runtime.version().feature() >= 25) {
61-
// In current native image, security providers need to get verified at build time,
62-
// but then are reinitialized at runtime
69+
if (INITIALIZE_AT_RUNTIME) {
70+
// Verify at build time, but reinitialize at runtime
6371
support.initializeAtRunTime("org.bouncycastle", "security provider");
6472
Security.addProvider(new BouncyCastleProvider());
6573
} else {

0 commit comments

Comments
 (0)