Skip to content

Fix obsolete X509Certificate2 Errors #14919

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

Merged
merged 4 commits into from
Jul 10, 2024
Merged

Conversation

ellahathaway
Copy link
Member

@ellahathaway ellahathaway commented Jul 8, 2024

Fixes dotnet/source-build#4494

Test build

My local build worked with thes changes, but I'm verifying with the source-build-lite pipeline as well.

@ellahathaway ellahathaway changed the title Replace obsolete X509Certificate Replace obsolete X509Certificate2.CreateFromSignedFile Jul 8, 2024
@ellahathaway
Copy link
Member Author

It looks like we may have to pull in the latest from runtime in order for this to work at the repo level.

@vcsjones
Copy link
Member

vcsjones commented Jul 9, 2024

👋 This is an interesting case as, currently, there is no replacement API for what you are using X509Certificate2 for. You are likely going to need to suppress the SYSLIB0057 obsoletion as X509CertificateLoader does not handle authenticode inputs.

cc @bartonjs - this is another example of needing to suppress the obsoletion.

@akoeplinger
Copy link
Member

akoeplinger commented Jul 9, 2024

See dotnet/docs#41662 (comment) for an example.

We'd need to wrap it in #if NET9_0_OR_GREATER but that still doesn't solve the issue that we don't have a new enough runtime in arcade that contains X509CertificateLoader.

I'd suggest just suppressing SYSLIB0057 for now.

@ellahathaway
Copy link
Member Author

@vcsjones @akoeplinger - Thanks for your help! I appreciate it. I've updated the PR given the guidance

@ellahathaway ellahathaway marked this pull request as ready for review July 9, 2024 16:18
@ellahathaway ellahathaway requested review from a team, vcsjones and akoeplinger July 9, 2024 16:18
@ellahathaway ellahathaway changed the title Replace obsolete X509Certificate2.CreateFromSignedFile Fix obsolete X509Certificate2 Errors Jul 9, 2024
@ellahathaway ellahathaway requested a review from chcosta July 9, 2024 16:21
ViktorHofer
ViktorHofer previously approved these changes Jul 9, 2024
chcosta
chcosta previously approved these changes Jul 9, 2024
@ellahathaway
Copy link
Member Author

Stage 2 build passed for arcade with these changes. I will have to investigate the arcade-pr failures after I finish with release work.

@bartonjs
Copy link
Member

bartonjs commented Jul 9, 2024

We'd need to wrap it in #if NET9_0_OR_GREATER ...

Or add a package reference to Microsoft.Bcl.Cryptography (the back-compat package)

bartonjs
bartonjs previously approved these changes Jul 9, 2024
@ellahathaway ellahathaway dismissed stale reviews from bartonjs, chcosta, and ViktorHofer via 05081fd July 9, 2024 21:51
@ellahathaway
Copy link
Member Author

One of the tests was failing because the filePath did not contain a certificate. This resulted in GetCertContentType() throwing an exception. As a fix, I placed the check for the cert type in the try-catch block.

@ellahathaway ellahathaway enabled auto-merge (squash) July 9, 2024 23:14
@ellahathaway ellahathaway merged commit 04cb1e3 into dotnet:main Jul 10, 2024
11 checks passed
@ellahathaway ellahathaway deleted the certloader branch July 10, 2024 15:20
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.

VMR Stage 2 Builds Failing in Arcade with Obsolete Reference
6 participants