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 — Support bc-fips in BouncyCastleSelfSignedCertGenerator by yawkat · Pull Request #13954 · netty/netty

Conversation

@yawkat

@yawkat yawkat commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

Motivation:

When using the bouncycastle FIPS dependencies (bcpkix-fips instead of bcpkix, and bc-fips instead of bcprov), BouncyCastleProvider is replaced by BouncyCastleFipsProvider. This made BouncyCastleSelfSignedCertGenerator fail even though all the necessary algorithms are present.

While bc-fips is only necessary for fips-compliant production deployments, and self-signed certs are only necessary in test deployments that don't have to be fips-compliant, this change is still useful because the fips and non-fips artifacts cannot exist alongside each other. So if you have a prod fips dependency, tests that also have a non-fips dependency for self-signed certs cannot live alongside each other. It's easiest to just use the fips dependency everywhere.

Modification:

Use reflection in BouncyCastleSelfSignedCertGenerator to instantiate whichever provider is available. This has the advantage of not needing a new dependency, though it may have some impact on native image deployments. For this reason I've also added the providers to the reflect-config.json.

No test is possible because it would require a different classpath. I tested manually that it works by changing to the fips dependencies and then running SelfSignedCertificateTest, and checking with a debugger that the correct provider was used.

Result:

SelfSignedCertificate will work with bc-fips dependencies.

Sorry, something went wrong.

Uh oh!

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

melix reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@yawkat
Support bc-fips in BouncyCastleSelfSignedCertGenerator
67bfd2a
Motivation:

When using the bouncycastle FIPS dependencies (bcpkix-fips instead of bcpkix, and bc-fips instead of bcprov), BouncyCastleProvider is replaced by BouncyCastleFipsProvider. This made BouncyCastleSelfSignedCertGenerator fail even though all the necessary algorithms are present.

While bc-fips is only necessary for fips-compliant production deployments, and self-signed certs are only necessary in test deployments that don't have to be fips-compliant, this change is still useful because the fips and non-fips artifacts cannot exist alongside each other. So if you have a prod fips dependency, tests that also have a non-fips dependency for self-signed certs cannot live alongside each other. It's easiest to just use the fips dependency everywhere.

Modification:

Use reflection in BouncyCastleSelfSignedCertGenerator to instantiate whichever provider is available. This has the advantage of not needing a new dependency, though it may have some impact on native image deployments. For this reason I've also added the providers to the reflect-config.json.

No test is possible because it would require a different classpath. I tested manually that it works by changing to the fips dependencies and then running SelfSignedCertificateTest, and checking with a debugger that the correct provider was used.

Result:

SelfSignedCertificate will work with bc-fips dependencies.
@yawkat

yawkat commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

Hmm the native tests fail because I added the BC metadata. What should I do about that?

All reactions

Sorry, something went wrong.

Uh oh!

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

@slandelle

slandelle commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

@yawkat On load, BC-FIPS performs some integrity check where it computes the checksum of the jar that contains le Provider class, validates it against the expected value stored into an embedded file and crashes on validation failure. So I don't think it can possibly work in a native image. It cannot be repackaged either.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

@slandelle let us at oracle worry about that :)

It shouldn't be an issue for this PR, as I didn't actually add the fips dependency.

All reactions

Sorry, something went wrong.

Uh oh!

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

@slandelle

slandelle commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

@slandelle let us at oracle worry about that :)

Ah ah ah. I'd be really curious about what you have in mind then. I guess either request BC to remove this check from the official jar or remove it yourself from the bytecode when compiling the native image.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

Honestly no clue yet. We use bc broadly (though mostly for pkcs#1 key loading which is a bit unfortunate), and we have to be fips-compliant in some places, and we are interested in getting more services to run on native image. So we'll hit that issue eventually and I'm sure someone from our team or the svm team can find a satisfactory (and compliant) solution.

All reactions

Sorry, something went wrong.

Uh oh!

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

@slandelle

slandelle commented Apr 5, 2024

Copy link
Copy Markdown
Contributor

Maybe I'm missing something but this check doesn't make any sense to me. If someone manages to temper the jar, he can temper the embedded checksum check as well.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 5, 2024

Copy link
Copy Markdown
Contributor Author

the ways of standards compliance are mysterious :)

slandelle reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

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

@chrisvest

chrisvest commented Apr 5, 2024

Copy link
Copy Markdown
Member

@gradinac would know what to do about the native image metadata check.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 8, 2024

Copy link
Copy Markdown
Contributor Author

I think @gradinac has left oracle

All reactions

Sorry, something went wrong.

Uh oh!

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

@normanmaurer

normanmaurer commented Apr 20, 2024

Copy link
Copy Markdown
Member

@yawkat maybe you can ping someone at oracle to see how we can fix this ?

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 20, 2024

Copy link
Copy Markdown
Contributor Author

oh i totally forgot about this, will follow up

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat
Fix reflect-config.json
ece198f
@yawkat

yawkat commented Apr 22, 2024

Copy link
Copy Markdown
Contributor Author

Okay apparently non-generated config goes into a separate file, so I've fixed that. Also changed the class name and moved from allDeclaredConstructors to explicitly stating the constructor.

All reactions

Sorry, something went wrong.

Uh oh!

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

@yawkat

yawkat commented Apr 24, 2024

Copy link
Copy Markdown
Contributor Author

@normanmaurer passing now

All reactions

Sorry, something went wrong.

Uh oh!

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

normanmaurer
normanmaurer approved these changes Apr 24, 2024
View reviewed changes
@normanmaurer
normanmaurer merged commit d868c7b into netty:4.1 Apr 27, 2024
@normanmaurer

normanmaurer commented Apr 27, 2024

Copy link
Copy Markdown
Member

@yawkat thanks a lot

All reactions

Sorry, something went wrong.

Uh oh!

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

chrisvest pushed a commit that referenced this pull request Apr 27, 2024
@yawkat @chrisvest
Support bc-fips in BouncyCastleSelfSignedCertGenerator (#13954)
c0503d6
Motivation:

When using the bouncycastle FIPS dependencies (bcpkix-fips instead of
bcpkix, and bc-fips instead of bcprov), BouncyCastleProvider is replaced
by BouncyCastleFipsProvider. This made
BouncyCastleSelfSignedCertGenerator fail even though all the necessary
algorithms are present.

While bc-fips is only necessary for fips-compliant production
deployments, and self-signed certs are only necessary in test
deployments that don't have to be fips-compliant, this change is still
useful because the fips and non-fips artifacts cannot exist alongside
each other. So if you have a prod fips dependency, tests that also have
a non-fips dependency for self-signed certs cannot live alongside each
other. It's easiest to just use the fips dependency everywhere.

Modification:

Use reflection in BouncyCastleSelfSignedCertGenerator to instantiate
whichever provider is available. This has the advantage of not needing a
new dependency, though it may have some impact on native image
deployments. For this reason I've also added the providers to the
reflect-config.json.

No test is possible because it would require a different classpath. I
tested manually that it works by changing to the fips dependencies and
then running SelfSignedCertificateTest, and checking with a debugger
that the correct provider was used.

Result:

SelfSignedCertificate will work with bc-fips dependencies.
chrisvest pushed a commit that referenced this pull request Apr 27, 2024
@yawkat @chrisvest
Support bc-fips in BouncyCastleSelfSignedCertGenerator (#13954)
f6a4533
Motivation:

When using the bouncycastle FIPS dependencies (bcpkix-fips instead of
bcpkix, and bc-fips instead of bcprov), BouncyCastleProvider is replaced
by BouncyCastleFipsProvider. This made
BouncyCastleSelfSignedCertGenerator fail even though all the necessary
algorithms are present.

While bc-fips is only necessary for fips-compliant production
deployments, and self-signed certs are only necessary in test
deployments that don't have to be fips-compliant, this change is still
useful because the fips and non-fips artifacts cannot exist alongside
each other. So if you have a prod fips dependency, tests that also have
a non-fips dependency for self-signed certs cannot live alongside each
other. It's easiest to just use the fips dependency everywhere.

Modification:

Use reflection in BouncyCastleSelfSignedCertGenerator to instantiate
whichever provider is available. This has the advantage of not needing a
new dependency, though it may have some impact on native image
deployments. For this reason I've also added the providers to the
reflect-config.json.

No test is possible because it would require a different classpath. I
tested manually that it works by changing to the fips dependencies and
then running SelfSignedCertificateTest, and checking with a debugger
that the correct provider was used.

Result:

SelfSignedCertificate will work with bc-fips dependencies.
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 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

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@yawkat @slandelle @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.