Skip to content

Commit 6f79076

Browse files
committed
Adapt BouncyCastleFeature to KDF-related changes in JDK 25+23
1 parent f51c636 commit 6f79076

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -60,8 +60,19 @@ public void afterRegistration(AfterRegistrationAccess access) {
6060
support.initializeAtRunTime("org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV", "RNG");
6161
Security.addProvider(CertUtils.BOUNCYCASTLE_PROVIDER);
6262

63+
// This is needed since jdk-25+23, see https://github.com/openjdk/jdk/pull/24393
64+
Security.addProvider(Security.getProvider("SunJCE"));
65+
6366
// Register runtime reflection here, not in a config, so it can be easily disabled
6467
String[] reflectiveClasses = new String[]{
68+
// SSLBasicKeyDerivation looks up the classes below reflectively since
69+
// jdk-25+23
70+
// See https://github.com/openjdk/jdk/pull/24393
71+
"com.sun.crypto.provider.HKDFKeyDerivation$HKDFSHA256",
72+
"com.sun.crypto.provider.HKDFKeyDerivation$HKDFSHA384",
73+
"com.sun.crypto.provider.HKDFKeyDerivation$HKDFSHA512",
74+
"sun.security.pkcs11.P11HKDF",
75+
// BouncyCastle looks up the classes below
6576
"org.bouncycastle.jcajce.provider.asymmetric.COMPOSITE$Mappings",
6677
"org.bouncycastle.jcajce.provider.asymmetric.DH$Mappings",
6778
"org.bouncycastle.jcajce.provider.asymmetric.DSA$Mappings",
@@ -160,9 +171,10 @@ public void afterRegistration(AfterRegistrationAccess access) {
160171

161172
for (String name : reflectiveClasses) {
162173
try {
163-
RuntimeReflection.register(Class.forName(name).getConstructor());
164-
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) {
165-
throw new RuntimeException("Could not register " + name + " constructor for reflective access!", e);
174+
RuntimeReflection.register(Class.forName(name));
175+
RuntimeReflection.register(Class.forName(name).getConstructors());
176+
} catch (SecurityException | ClassNotFoundException e) {
177+
throw new RuntimeException("Could not register " + name + " for reflective access!", e);
166178
}
167179
}
168180
}

0 commit comments

Comments
 (0)