Error with BouncyCastle in native images #46753
-
Hi Team, I'm getting below error while using bouncyCastle in my quarkus application, I have tried below 2 following approach Case 1) I have added the quarkus.security.security-providers=BC in my config. then getting below error. com.oracle.svm.core.jdk.UnsupportedFeatureError: Trying to verify a provider that was not registered at build time: BC version 1.7801. All providers must be registered and verified in the Native Image builder. Printed All provider list: Provider: SUN Case 2) I have manually register the provider but in that case while I'm using it to get cipher instance Cipher.getInstance("AES/ECB/PKCS7Padding", new BouncyCastleProvider()); then got the below error java.security.NoSuchAlgorithmException: No such algorithm: AES/ECB/PKCS7Padding @PostConstruct
public void init() {
if (Security.getProvider("BC") == null) {
log.info("Registering BouncyCastle Provider...");
Security.addProvider(new BouncyCastleProvider());
} else {
log.info("BouncyCastle provider already registered ");
}
} Printed All provider list: Provider: SUN Can you please assist what should I do to use AES/ECB/PKCS7Padding with bouncy castle ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@sberyozkin @geoand |
Beta Was this translation helpful? Give feedback.
@nitinty Np, thanks for creating the reproducer. Adding the
quarkus-security
dependency as documented at the top of the doc at https://quarkus.io/guides/security-customization#quarkus-security-dependency resolves the problem.