Skip to content

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

Closed
@HarrDevY

Description

@HarrDevY

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions