diff --git a/bouncy-castle/src/main/kotlin/de/cmdjulian/graal/bouncycastle/BouncyCastleFeature.kt b/bouncy-castle/src/main/kotlin/de/cmdjulian/graal/bouncycastle/BouncyCastleFeature.kt index 42bc832..88ac2c0 100644 --- a/bouncy-castle/src/main/kotlin/de/cmdjulian/graal/bouncycastle/BouncyCastleFeature.kt +++ b/bouncy-castle/src/main/kotlin/de/cmdjulian/graal/bouncycastle/BouncyCastleFeature.kt @@ -2,6 +2,7 @@ package de.cmdjulian.graal.bouncycastle import org.graalvm.nativeimage.hosted.Feature import org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess +import org.graalvm.nativeimage.hosted.RuntimeClassInitialization import java.security.Provider import java.security.Security @@ -21,6 +22,11 @@ class BouncyCastleFeature : Feature { } println("INFO: found and registered bouncy castle") + RuntimeClassInitialization.initializeAtBuildTime("org.bouncycastle") + RuntimeClassInitialization.initializeAtRunTime( + "org.bouncycastle.jcajce.provider.drbg.DRBG\$Default", + "org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV", + ) Security.addProvider(clazz.getConstructor().newInstance() as Provider) } } diff --git a/bouncy-castle/src/main/resources/META-INF/native-image/native-image.properties b/bouncy-castle/src/main/resources/META-INF/native-image/native-image.properties index 20c8679..fe50d31 100644 --- a/bouncy-castle/src/main/resources/META-INF/native-image/native-image.properties +++ b/bouncy-castle/src/main/resources/META-INF/native-image/native-image.properties @@ -1,3 +1 @@ -Args = --features=de.cmdjulian.graal.bouncycastle.BouncyCastleFeature \ ---initialize-at-build-time=org.bouncycastle \ ---initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG$Default,org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV +Args = --features=de.cmdjulian.graal.bouncycastle.BouncyCastleFeature