Skip to content
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

Change the Unix cert store to store certificates with AES256+SHA256 PBES2 #112749

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

vcsjones
Copy link
Member

Today, we store certificates on-disk with Linux that result in 3DES and SHA1 being used. If you are on a FIPS-constrained environment, OpenSSL will fail to be able to read and write to a certificate store.

This changes the Unix stores to use AES256+SHA256 using the new ExportPkcs12 API. Since we have more control over the export now, this also allows using a single round for the KDFs. We don't need 2000 rounds since a null password is used.

Fixes #111560

@Copilot Copilot bot review requested due to automatic review settings February 20, 2025 16:45

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR updates the Unix certificate store to use AES256+SHA256 PBES2 by leveraging the new ExportPkcs12 API, thereby replacing the legacy 3DES and SHA1 encryption. Key changes include:

  • Adding two new unit tests to verify the updated PBE parameters and ensure backwards compatibility with legacy encrypted certificates.
  • Updating the OpenSslDirectoryBasedStoreProvider to use ExportPkcs12 with AES256+SHA256 and a reduced iteration count.

Reviewed Changes

File Description
src/libraries/System.Security.Cryptography/tests/X509Certificates/X509FilesystemTests.Unix.cs Added unit tests to verify correct encryption parameters in certificate store operations
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslDirectoryBasedStoreProvider.cs Refactored certificate export logic to utilize the new ExportPkcs12 API with updated PBE parameters

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

@vcsjones
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop-linux

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vcsjones
Copy link
Member Author

New tests passed in outerloop. Merging.

Screenshot 2025-02-20 at 7 31 41 PM Screenshot 2025-02-20 at 7 31 59 PM

@vcsjones vcsjones merged commit 8d3b245 into dotnet:main Feb 21, 2025
80 of 87 checks passed
@vcsjones vcsjones deleted the fix-111560 branch February 21, 2025 00:32
@vcsjones vcsjones added this to the 10.0.0 milestone Feb 21, 2025
@vcsjones vcsjones added the cryptographic-docs-impact Issues impacting cryptographic docs. Cleared and reused after documentation is updated each release. label Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Security cryptographic-docs-impact Issues impacting cryptographic docs. Cleared and reused after documentation is updated each release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X509Store.Add Fails On Ubuntu 22.04 in FIPS Mode
2 participants