8000 [Native Image] Using Bouncy Castle provider ... again · Issue #10736 · oracle/graal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Native Image] Using Bouncy Castle provider . 8000 .. again #10736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
HarrDevY opened this issue Feb 21, 2025 · 5 comments
Closed
1 of 2 tasks

[Native Image] Using Bouncy Castle provider ... again #10736

HarrDevY opened this issue Feb 21, 2025 · 5 comments
Assignees

Comments

@HarrDevY
Copy link
HarrDevY commented Feb 21, 2025

Describe the Issue

Hi,
I would really appreciate if someone could give a complete working example how to get bouncy castle running with native image. This issue has been discussed many times in past, but all post about it use deprecated code. You'll find a repository to reproduce this here:

https://github.com/HarrDevY/native-register-bouncy-castle

Steps to reproduce:

  • use GraalVM 21.0.5
  • run mvn -Pnative compile:native (will work fine)
  • run application with target/registerbouncycastle
  • execute a curl curl -i http://localhost:8080/encrypt?val=foobar

it will fail with error Trying to verify a provider that was not registered at build time: BC version 1.8. All providers must be registered and verified in the Native Image builder

Please point out by giving a working configuration or source code example how to fix this. Don't use any deprecated thinks like Feature ...

Thanks!

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "21.0.5" 2024-10-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.5+9.1 (build 21.0.5+9-LTS-jvmci-23.1-b48, mixed mode, sharing)

Operating System and Version

linux/debian Linux RDDE03C4 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux

Troubleshooting Confirmation

Run Command

target/registerbouncycastle

Expected Behavior

Encrypt string

Actual Behavior

Exeception thrown: Trying to verify a provider that was not registered at build time: BC version 1.8. All providers must be registered and verified in the Native Image builder

Steps to Reproduce

see text above

Additional Context

My goal is to evolve the above mentioned repository with your help to a complete working example, so other ppl have a reference to look up.

Run-Time Log Output and Error Messages

No response

@selhagani
Copy link
Member 8000

Hi @HarrDevY,

Thank you for reaching out to us about this!
Could you please try retesting using the latest available version of GraalVM? you can find it here: https://github.com/graalvm/graalvm-ce-builds/releases/
Also can you please try using the tracing agent to generate the configuration files and then try testing again? More information on how to use it can be found here: https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#agent-support

@HarrDevY
Copy link
Author
HarrDevY commented Feb 24, 2025

Hi @selhagani ,

generated configuration files are already part of the project: https://github.com/HarrDevY/native-register-bouncy-castle/tree/main/src/main/resources/META-INF/native-image
I will check latest with latest version, thanks.

@HarrDevY
Copy link
Author

I have a thread running with bouncy castle as well: bcgit/bc-java#2001

@winfriedgerlach suggested to use a Feature implementation and additional graalvm build args. I've updated my repo according to it. Now it works, but it includes GraalSDK artifact and requires -H:+AllowDeprecatedBuilderClassesOnImageClasspath build arg. Is there an other way to achive the same result?

@winfriedgerlach
Copy link

@HarrDevY wasn't me, I think you mean @ligefeiBouncycastle ;-)

@HarrDevY
Copy link
Author

Oops, sorry. You are right 😊 The final version without using GraalSDK can be found im my repo. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0