8000 Remove all SYSLIB0057 suppressions and replace obsolete X509Certificate2 constructors with X509CertificateLoader by Copilot · Pull Request #62552 · dotnet/aspnetcore · GitHub
[go: up one dir, main page]

Skip to content

Remove all SYSLIB0057 suppressions and replace obsolete X509Certificate2 constructors with X509CertificateLoader #62552

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Prev Previous commit
Fix remaining obsolete X509Certificate usage and invalid LoadPkcs12 o…
…verloads

Co-authored-by: BrennanConroy <7574801+BrennanConroy@users.noreply.github.com>
  • Loading branch information
Copilot and BrennanConroy committed Jul 3, 2025
commit f4974a4bd9dc8e0f786f87b97eb6466b2da20d1b
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static X509Certificate2 GenerateManualCertificate()
req.CertificateExtensions.Add(sanBuilder.Build());
// Sign
using var crt = req.CreateSelfSigned(now, now.AddDays(14)); // 14 days is the max duration of a certificate for this
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx));
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx), password: null);

// Save
store.Add(cert);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static X509Certificate2 GenerateManualCertificate()
req.CertificateExtensions.Add(sanBuilder.Build());
// Sign
using var crt = req.CreateSelfSigned(now, now.AddDays(14)); // 14 days is the max duration of a certificate for this
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx));
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx), password: null);

// Save
store.Add(cert);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task HttpOptionsSetOntoHttpClientHandler()
return testHttpHandler;
};
httpOptions.Cookies.Add(new Cookie("Name", "Value", string.Empty, "fakeuri.org"));
var clientCertificate = new X509Certificate(Array.Empty<byte>());
var clientCertificate = X509CertificateLoader.LoadCertificate(Array.Empty<byte>());
httpOptions.ClientCertificates.Add(clientCertificate);
httpOptions.UseDefaultCredentials = false;
httpOptions.Credentials = Mock.Of<ICredentials>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task HttpOptionsSetOntoWebSocketOptions()

var httpOptions = new HttpConnectionOptions();
httpOptions.Cookies.Add(new Cookie("Name", "Value", string.Empty, "fakeuri.org"));
var clientCertificate = new X509Certificate(Array.Empty<byte>());
var clientCertificate = X509CertificateLoader.LoadCertificate(Array.Empty<byte>());
httpOptions.ClientCertificates.Add(clientCertificate);
httpOptions.UseDefaultCredentials = false;
httpOptions.Credentials = Mock.Of<ICredentials>();
Expand Down
Loading
0