Skip to content

Commit

Permalink
Adapt to CKeyStore.loadKeysOrCertificateChains signature change
Browse files Browse the repository at this point in the history
Backport of:
graalvm@0c88c7d

JDK 17.0.5 includes the change needed to look for the new signature.
This will also fix the issue seen with JDK 11 when 11.0.18 comes around.

Closes: oracle#428
  • Loading branch information
jerboaa committed Oct 12, 2022
1 parent 7c84b26 commit 840012c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,13 @@ private static void registerSunMSCAPIConfig(BeforeAnalysisAccess a) {
"java.security.KeyException", "java.security.KeyStoreException", "java.security.ProviderException",
"java.security.SignatureException", "java.lang.OutOfMemoryError");

/*
* JDK-6782021 changed the `loadKeysOrCertificateChains` method signature, so we try the new
* signature first and fall back to the old one in case we're on a JDK without the change.
*/
a.registerReachabilityHandler(SecurityServicesFeature::registerLoadKeysOrCertificateChains,
method(a, "sun.security.mscapi.CKeyStore", "loadKeysOrCertificateChains", String.class));
optionalMethod(a, "sun.security.mscapi.CKeyStore", "loadKeysOrCertificateChains", String.class, int.class)
.orElseGet(() -> method(a, "sun.security.mscapi.CKeyStore", "loadKeysOrCertificateChains", String.class)));
a.registerReachabilityHandler(SecurityServicesFeature::registerGenerateCKeyPair,
method(a, "sun.security.mscapi.CKeyPairGenerator$RSA", "generateCKeyPair", String.class, int.class, String.class));
a.registerReachabilityHandler(SecurityServicesFeature::registerCPrivateKeyOf,
Expand Down

0 comments on commit 840012c

Please sign in to comment.