Skip to content

Commit

Permalink
Adapt to CKeyStore.loadKeysOrCertificateChains signature change
Browse files Browse the repository at this point in the history
  • Loading branch information
pejovica committed Sep 14, 2022
1 parent 39b8fb3 commit 0c88c7d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ private static void registerSunMSCAPIConfig(BeforeAnalysisAccess a) {
"java.security.KeyException", "java.security.KeyStoreException", "java.security.ProviderException",
"java.security.SignatureException", "java.lang.OutOfMemoryError");

if (JavaVersionUtil.JAVA_SPEC >= 19) {
a.registerReachabilityHandler(SecurityServicesFeature::registerLoadKeysOrCertificateChains,
method(a, "sun.security.mscapi.CKeyStore", "loadKeysOrCertificateChains", String.class, int.class));
} else {
a.registerReachabilityHandler(SecurityServicesFeature::registerLoadKeysOrCertificateChains,
method(a, "sun.security.mscapi.CKeyStore", "loadKeysOrCertificateChains", String.class));
}
/*
* 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,
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 Expand Up @@ -836,7 +836,7 @@ private Function<Object, Object> constructVerificationCacheCleaner(Class<?> jceS
* Need to synchronize the iteration of JceSecurity.verificationResults. In the
* original implementation verificationResults is always accessed and modified
* via the static synchronized JceSecurity.getVerificationResult().
*
*
* Note that even if the value of the JceSecurity.verificationResults may be
* modified concurrently it doesn't affect the correctness of the substitution.
* Its value is never cached (by using RecomputeFieldValue.disableCaching) and
Expand Down

0 comments on commit 0c88c7d

Please sign in to comment.