GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use initialized BouncyCastle providers when available by michalvavrik · Pull Request #14855 · netty/netty

Conversation

@michalvavrik

@michalvavrik michalvavrik commented Feb 23, 2025

Copy link
Copy Markdown
Contributor

Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader' class used by the SSL context always instantiated a new BouncyCastle provider when one of supported providers were on the classpath. When Netty is used in a native image created with GraalVM, the moment of initialization matters. Providers instantiated when the native image is built will see different classes than providers instantiated during runtime unless every single class the BouncyCastle loads using the reflection API is registered for a reflection. Some frameworks like Quarkus makes sure that BouncyCastle providers are created for users and registered with the Java Security API. However in this case, the providers prepared by Quarkus are ignored and users are left to a difficult task to find all required classes loaded by the BouncyCastle for their use case and register them. This commit prefers the providers registered against the Java Security API and fallbacks to manual class instantiation, so that user experience improves when using native executables.

Modifications:

I have modified 'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load the 2 supported BouncyCastle providers (BC/BCFIPS) from the Java Security API first and fallback to previous behavior when the providers are not available. I didn't find any test class explicitly testing this 'BouncyCastlePemReader', therefore I added a new test class, 'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java', that assures providers are loaded from the Java Security API, but when not available, Netty creates a new providers if respective classes are available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native images.

Fixes #14826.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@normanmaurer
normanmaurer requested a review from chrisvest February 24, 2025 07:00
@normanmaurer normanmaurer added this to the 4.1.119.Final milestone Feb 24, 2025
normanmaurer
normanmaurer requested changes Feb 24, 2025
View reviewed changes
Comment thread handler/src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread handler/src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michalvavrik
michalvavrik requested a review from normanmaurer February 24, 2025 09:03
normanmaurer
normanmaurer reviewed Feb 24, 2025
View reviewed changes
Comment thread handler/src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@michalvavrik
Use initialized BouncyCastle providers when available
12f3755
Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader' class used by the SSL context
always instantiated a new BouncyCastle provider when one of supported providers were on the classpath.
When Netty is used in a native image created with GraalVM, the moment of initialization matters.
Providers instantiated when the native image is built will see different classes than providers instantiated
during runtime unless every single class the BouncyCastle loads using the reflection API is registered for a reflection.
Some frameworks like Quarkus makes sure that BouncyCastle providers are created for users and registered with the Java
Security API. However in this case, the providers prepared by Quarkus are ignored and users are left
to a difficult task to find all required classes loaded by the BouncyCastle for their use case and register them.
This commit prefers the providers registered against the Java Security API and fallbacks to manual class instantiation,
so that user experience improves when using native executables.

Modifications:

I have modified 'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load the 2 supported BouncyCastle
providers (BC/BCFIPS) from the Java Security API first and fallback to previous behavior when the providers are not available.
I didn't find any test class explicitly testing this 'BouncyCastlePemReader', therefore I added a new test class,
'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java', that assures providers are loaded from the Java Security
API, but when not available, Netty creates a new providers if respective classes are available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native images
chrisvest
chrisvest approved these changes Feb 24, 2025
View reviewed changes
@chrisvest
chrisvest merged commit f0a546d into netty:4.1 Feb 24, 2025
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Feb 24, 2025
@michalvavrik @chrisvest
Use initialized BouncyCastle providers when available (netty#14855)
c73b9bc
Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader'
class used by the SSL context always instantiated a new BouncyCastle
provider when one of supported providers were on the classpath. When
Netty is used in a native image created with GraalVM, the moment of
initialization matters. Providers instantiated when the native image is
built will see different classes than providers instantiated during
runtime unless every single class the BouncyCastle loads using the
reflection API is registered for a reflection. Some frameworks like
Quarkus makes sure that BouncyCastle providers are created for users and
registered with the Java Security API. However in this case, the
providers prepared by Quarkus are ignored and users are left to a
difficult task to find all required classes loaded by the BouncyCastle
for their use case and register them. This commit prefers the providers
registered against the Java Security API and fallbacks to manual class
instantiation, so that user experience improves when using native
executables.

Modifications:

I have modified
'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load
the 2 supported BouncyCastle providers (BC/BCFIPS) from the Java
Security API first and fallback to previous behavior when the providers
are not available. I didn't find any test class explicitly testing this
'BouncyCastlePemReader', therefore I added a new test class,
'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java',
that assures providers are loaded from the Java Security API, but when
not available, Netty creates a new providers if respective classes are
available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native
images.

Fixes netty#14826.
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Feb 24, 2025
@michalvavrik @chrisvest
Use initialized BouncyCastle providers when available (netty#14855)
64ebfbf
Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader'
class used by the SSL context always instantiated a new BouncyCastle
provider when one of supported providers were on the classpath. When
Netty is used in a native image created with GraalVM, the moment of
initialization matters. Providers instantiated when the native image is
built will see different classes than providers instantiated during
runtime unless every single class the BouncyCastle loads using the
reflection API is registered for a reflection. Some frameworks like
Quarkus makes sure that BouncyCastle providers are created for users and
registered with the Java Security API. However in this case, the
providers prepared by Quarkus are ignored and users are left to a
difficult task to find all required classes loaded by the BouncyCastle
for their use case and register them. This commit prefers the providers
registered against the Java Security API and fallbacks to manual class
instantiation, so that user experience improves when using native
executables.

Modifications:

I have modified
'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load
the 2 supported BouncyCastle providers (BC/BCFIPS) from the Java
Security API first and fallback to previous behavior when the providers
are not available. I didn't find any test class explicitly testing this
'BouncyCastlePemReader', therefore I added a new test class,
'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java',
that assures providers are loaded from the Java Security API, but when
not available, Netty creates a new providers if respective classes are
available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native
images.

Fixes netty#14826.
@michalvavrik
michalvavrik deleted the feature/improve-bc-provider-experience-in-native branch February 25, 2025 10:25
@michalvavrik michalvavrik mentioned this pull request Feb 25, 2025
Workaround Netty SSL Bouncycastle issue in native mode quarkusio/quarkus#46307
Merged
normanmaurer pushed a commit that referenced this pull request Feb 25, 2025
@chrisvest @michalvavrik
Use initialized BouncyCastle providers when available (#14855) (#14862)
51fb006
Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader'
class used by the SSL context always instantiated a new BouncyCastle
provider when one of supported providers were on the classpath. When
Netty is used in a native image created with GraalVM, the moment of
initialization matters. Providers instantiated when the native image is
built will see different classes than providers instantiated during
runtime unless every single class the BouncyCastle loads using the
reflection API is registered for a reflection. Some frameworks like
Quarkus makes sure that BouncyCastle providers are created for users and
registered with the Java Security API. However in this case, the
providers prepared by Quarkus are ignored and users are left to a
difficult task to find all required classes loaded by the BouncyCastle
for their use case and register them. This commit prefers the providers
registered against the Java Security API and fallbacks to manual class
instantiation, so that user experience improves when using native
executables.

Modifications:

I have modified
'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load
the 2 supported BouncyCastle providers (BC/BCFIPS) from the Java
Security API first and fallback to previous behavior when the providers
are not available. I didn't find any test class explicitly testing this
'BouncyCastlePemReader', therefore I added a new test class,
'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java',
that assures providers are loaded from the Java Security API, but when
not available, Netty creates a new providers if respective classes are
available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native
images.

Fixes #14826.

Co-authored-by: Michal Vavřík <[email protected]>
chrisvest added a commit that referenced this pull request Feb 26, 2025
@chrisvest @michalvavrik
Use initialized BouncyCastle providers when available (#14855) (#14863)
345a52e
Motivation:

Before this change, the 'io.netty.handler.ssl.BouncyCastlePemReader'
class used by the SSL context always instantiated a new BouncyCastle
provider when one of supported providers were on the classpath. When
Netty is used in a native image created with GraalVM, the moment of
initialization matters. Providers instantiated when the native image is
built will see different classes than providers instantiated during
runtime unless every single class the BouncyCastle loads using the
reflection API is registered for a reflection. Some frameworks like
Quarkus makes sure that BouncyCastle providers are created for users and
registered with the Java Security API. However in this case, the
providers prepared by Quarkus are ignored and users are left to a
difficult task to find all required classes loaded by the BouncyCastle
for their use case and register them. This commit prefers the providers
registered against the Java Security API and fallbacks to manual class
instantiation, so that user experience improves when using native
executables.

Modifications:

I have modified
'src/main/java/io/netty/handler/ssl/BouncyCastlePemReader.java' to load
the 2 supported BouncyCastle providers (BC/BCFIPS) from the Java
Security API first and fallback to previous behavior when the providers
are not available. I didn't find any test class explicitly testing this
'BouncyCastlePemReader', therefore I added a new test class,
'src/test/java/io/netty/handler/ssl/BouncyCastlePemReaderTest.java',
that assures providers are loaded from the Java Security API, but when
not available, Netty creates a new providers if respective classes are
available on the classpath.

Result:

It will be easier to use SSL context with BouncyCastle support in native
images.

Fixes #14826.

Co-authored-by: Michal Vavřík <[email protected]>
@dongjoon-hyun dongjoon-hyun mentioned this pull request Mar 4, 2025
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final apache/spark#50150
Closed
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
3d949af
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
0403c8e
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to dongjoon-hyun/spark that referenced this pull request Mar 5, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
01cef5e
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
@dongjoon-hyun dongjoon-hyun mentioned this pull request Mar 5, 2025
[SPARK-51387][BUILD][4.0] Upgrade Netty to 4.1.119.Final apache/spark#50174
Closed
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
338772a
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit e84c345)
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 10, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
7779d8b
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
fb76b60
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
830b8a6
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Ko-dany pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @Ko-dany
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
fa21932
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
This was referenced Sep 14, 2026
Http2: Reserve promised stream for PUSH_PROMISE after local RST_STREAM #17471
Closed
cache failure 1233e4a5 #17565
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@normanmaurer normanmaurer normanmaurer requested changes
@chrisvest chrisvest chrisvest approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.119.Final

Development

Successfully merging this pull request may close these issues.

Improve SSL context support using BouncyCastlePemReader in native images

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@michalvavrik @chrisvest @normanmaurer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.