Skip to content

Conversation

@edwardneal
Copy link
Contributor

Description

This picks up from a comment yesterday in #3660 from @mdaigle, moving CoreCryptoTests into the unit tests project.

The CEK-based tests (TestRsaCryptoWithNativeBaseline) had already removed the use of reflection, so I've ported those across. There were also AEAD-based tests which still used reflection, so I removed those too.

The old version of the tests contained the TCECryptoNativeBaseline.txt and TCECryptoNativeBaselineRsa.txt files, with various parsing logic to convert the hexadecimal strings into byte arrays. I've turned these byte arrays into embedded resources because several of them are about 4KB in size and I wanted to load them in a consistent way. I'm not completely happy with the approach though, it leads to a lot of small files. I did consider putting them in one or more JSON files (so we'd eliminate the use of the custom parsing logic without adding so many files - perhaps one file for each of the 32 AEAD-based test cases and the 3 CEK-based test cases) but it seemed like an unnecessary layer of indirection. I'm happy to go with whichever option you'd prefer.

It's also worth noting that this lifts a hardcoded certificate out of TCECryptoNativeBaselineRsa.txt. This was always there, but it's technically a hardcoded credential and might be noticed as such. We use this to decrypt a CEK and verify its contents against the SQL Server native code, so it needs to remain in situ.

Issues

Follows up #3660 comment.

Testing

New tests run successfully.

@edwardneal edwardneal requested a review from a team as a code owner October 21, 2025 20:55
@paulmedynski
Copy link
Contributor

/azp run

@paulmedynski paulmedynski self-assigned this Oct 22, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@edwardneal
Copy link
Contributor Author

Thanks @paulmedynski - I'd missed the extracted CEK certificate. I've just added it and pushed.

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

This isn't run on MacOS at the moment, and the CEK certificate isn't compatible with the OS.
@edwardneal
Copy link
Contributor Author

The NativeColumnEncryptionKeyBaseline class' test was failing to run on Mac because the baseline CEK certificate couldn't be loaded by the OS. I've skipped the class for now, could someone re-run CI please?

@mdaigle
Copy link
Contributor

mdaigle commented Nov 5, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.99%. Comparing base (37a9c99) to head (1876fb8).
⚠️ Report is 19 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (37a9c99) and HEAD (1876fb8). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (37a9c99) HEAD (1876fb8)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3709      +/-   ##
==========================================
- Coverage   77.35%   69.99%   -7.37%     
==========================================
  Files         271      266       -5     
  Lines       45123    43873    -1250     
==========================================
- Hits        34907    30708    -4199     
- Misses      10216    13165    +2949     
Flag Coverage Δ
addons ?
netcore 70.05% <ø> (-7.30%) ⬇️
netfx 69.39% <ø> (-7.04%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdaigle mdaigle merged commit 12c76f6 into dotnet:main Nov 6, 2025
236 checks passed
@edwardneal edwardneal deleted the tests/move-corecryptotests branch November 6, 2025 21:49
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