|
1 | 1 | /*
|
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. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * The Universal Permissive License (UPL), Version 1.0
|
@@ -60,8 +60,19 @@ public void afterRegistration(AfterRegistrationAccess access) {
|
60 | 60 | support.initializeAtRunTime("org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV", "RNG");
|
61 | 61 | Security.addProvider(CertUtils.BOUNCYCASTLE_PROVIDER);
|
62 | 62 |
|
| 63 | + // This is needed since jdk-25+23, see https://github.com/openjdk/jdk/pull/24393 |
| 64 | + Security.addProvider(Security.getProvider("SunJCE")); |
| 65 | + |
63 | 66 | // Register runtime reflection here, not in a config, so it can be easily disabled
|
64 | 67 | 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 |
65 | 76 | "org.bouncycastle.jcajce.provider.asymmetric.COMPOSITE$Mappings",
|
66 | 77 | "org.bouncycastle.jcajce.provider.asymmetric.DH$Mappings",
|
67 | 78 | "org.bouncycastle.jcajce.provider.asymmetric.DSA$Mappings",
|
@@ -160,9 +171,10 @@ public void afterRegistration(AfterRegistrationAccess access) {
|
160 | 171 |
|
161 | 172 | for (String name : reflectiveClasses) {
|
162 | 173 | 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); |
166 | 178 | }
|
167 | 179 | }
|
168 | 180 | }
|
|
0 commit comments