-
Notifications
You must be signed in to change notification settings - Fork 574
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
Replace use of obsolete X509Certificate2 API #5688
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,7 +168,23 @@ X509CertificateCollection GetFileCertificate() | |
var filePath = _dashboardOptions.ResourceServiceClient.ClientCertificate.FilePath; | ||
var password = _dashboardOptions.ResourceServiceClient.ClientCertificate.Password; | ||
|
||
return [new X509Certificate2(filePath, password)]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "99%" of the reason to use the new X509CertificateLoader over the old constructors is to not load a PKCS#12/PFX when you weren't expecting to. Since you were expecting to load a PFX, and you're loading from a local file, it's not the end of the world if you continue calling the legacy constructor. (And since you're only loading it once you don't care about "we made parallel-loading the same PFX better" feature, etc.) So, while it is forward looking to get off of this ctor and on to the new loader model, it's not "important" right now. |
||
var certBytes = File.ReadAllBytes(filePath); | ||
|
||
var certContentType = X509Certificate2.GetCertContentType(certBytes); | ||
|
||
if (certContentType is X509ContentType.Pkcs12) | ||
{ | ||
return [X509CertificateLoader.LoadPkcs12(certBytes, password)]; | ||
} | ||
else | ||
{ | ||
if (password is not null) | ||
{ | ||
_logger.LogDebug("Resource service certificate {FilePath} has type {Type} which does not support passwords, yet a password was configured. The certificate password will be ignored.", filePath, certContentType); | ||
} | ||
|
||
return [X509CertificateLoader.LoadCertificate(certBytes)]; | ||
} | ||
} | ||
|
||
X509CertificateCollection GetKeyStoreCertificate() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we can't get to the final version of the package for the .NET 9 release? Will timings work out?
If not, is it ok to ship a preview package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joperezr @davidfowl any concerns here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some concerns, but perhaps not really ship-blockers. Starting from RC2, all of the packages from dotnet/runtime will only flow internally, and so far we are mostly just building externally. Our two options would be either ship depending on RC2 build (which while not ideal wouldn't have a big impact since the dashboard ships as a published app with no package references, and hence it can be stable still), or building internally so that we get the final 9.0 version that will get shipped. cc: @bartonjs