Skip to content

Make org.bouncycastle.jce.provider.BouncyCastleProvider optional by deferring initialization (#15756)#15788

Merged
normanmaurer merged 1 commit into
netty:4.2from
chrisvest:4.2-bc-optional
Oct 25, 2025
Merged

Make org.bouncycastle.jce.provider.BouncyCastleProvider optional by deferring initialization (#15756)#15788
normanmaurer merged 1 commit into
netty:4.2from
chrisvest:4.2-bc-optional

Conversation

@chrisvest
Copy link
Copy Markdown
Member

Motivation:

Initialization of the Algorithms class causes
java.lang.ClassNotFoundException if
org.bouncycastle.jce.provider.BouncyCastleProvider is not present on the classpath.

       Caused by:
        java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
            ... 6 more

Follow up to #15734

Modification:

Make org.bouncycastle.jce.provider.BouncyCastleProvider optional by deferring initialization.

Result:

In case the CertificateBuilder is configured with custom provider instance, org.bouncycastle.jce.provider.BouncyCastleProvider will never be initialized.

If there is no issue then describe the changes introduced by this PR.

(cherry picked from commit 81ac843)

…eferring initialization (netty#15756)

Motivation:

Initialization of the `Algorithms` class causes
`java.lang.ClassNotFoundException` if
`org.bouncycastle.jce.provider.BouncyCastleProvider` is not present on
the classpath.

```
       Caused by:
        java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)
            ... 6 more
```

Follow up to netty#15734

Modification:

Make `org.bouncycastle.jce.provider.BouncyCastleProvider` optional by
deferring initialization.

Result:

In case the `CertificateBuilder` is configured with custom `provider`
instance, `org.bouncycastle.jce.provider.BouncyCastleProvider` will
never be initialized.

If there is no issue then describe the changes introduced by this PR.

Signed-off-by: Andriy Redko <drreta@gmail.com>
(cherry picked from commit 81ac843)
@normanmaurer normanmaurer merged commit 321d065 into netty:4.2 Oct 25, 2025
19 checks passed
@chrisvest chrisvest deleted the 4.2-bc-optional branch October 25, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants