Skip to content

Merge SqlColumnEncryptionCertificateStoreProvider #2521

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

Conversation

edwardneal
Copy link
Contributor

Contributes to #1261.

This sits alongside #2501, and ports the SqlColumnEncryptionCertificateStoreProvider class. Once again, this version uses the .NET approach of SHA256.Create() rather than the .NET Framework approach of constructing a new SHA256Cng instance.

I've separated this class from the other PR because of the slightly different implementation between .NET and .NET Framework. When the .NET Framework code performs encryption, generates signatures and validates signatures, it references the PrivateKey property and casts it to an RSACryptoServiceProvider. The .NET code uses the GetRSAPrivateKey() method and works with the RSA base class instead. This means that the unmerged .NET Framework code can't use certificates with CNG keys; the post-merge implementation will be able to do so.

This also ports support for CNG keys from .NET to .NET Framework.
Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.66%. Comparing base (5cb73fd) to head (a81eb63).

Current head a81eb63 differs from pull request most recent head 5dfaecf

Please upload reports for the commit 5dfaecf to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2521      +/-   ##
==========================================
- Coverage   72.80%   72.66%   -0.14%     
==========================================
  Files         311      310       -1     
  Lines       61709    61547     -162     
==========================================
- Hits        44925    44724     -201     
- Misses      16784    16823      +39     
Flag Coverage Δ
addons 92.88% <ø> (ø)
netcore 77.09% <100.00%> (-0.09%) ⬇️
netfx 70.38% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JRahnama
Copy link
Contributor

JRahnama commented May 20, 2024

Thank you @edwardneal. This looks good as it is.

Just a minor request, while you are working on this, is it possible to address the warnings on SqlColumnEncryptionCertificateStoreProvider.Windows class?

Constant names have name rule violation and instead of var can you change them to use explicit type or some others such as changing Int16 to short please or that needs a different PR for a different purpose?

@JRahnama JRahnama added the Code Health 💊 Issues/PRs that are targeted to source code quality improvements. label May 20, 2024
@JRahnama JRahnama added this to the 6.0-preview1 milestone May 20, 2024
@edwardneal
Copy link
Contributor Author

edwardneal commented May 20, 2024

Thanks @JRahnama. The coding style changes were small enough that they don't leave the diff looking unreadable; I've rolled them into this PR for simplicity's sake.

@saurabh500
Copy link
Contributor

@David-Engel @JRahnama I think this is OK to merge. CI is green, no merge conflicts. Changes look good.

@JRahnama JRahnama merged commit 8777fce into dotnet:main Jun 25, 2024
148 checks passed
@edwardneal edwardneal deleted the issue-1261-certificate-column-encryption-provider branch August 31, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Health 💊 Issues/PRs that are targeted to source code quality improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants