Skip to content

Commit f4974a4

Browse files
Fix remaining obsolete X509Certificate usage and invalid LoadPkcs12 overloads
Co-authored-by: BrennanConroy <[email protected]>
1 parent afe29ff commit f4974a4

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Servers/Kestrel/samples/WebTransportInteractiveSampleApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static X509Certificate2 GenerateManualCertificate()
192192
req.CertificateExtensions.Add(sanBuilder.Build());
193193
// Sign
194194
using var crt = req.CreateSelfSigned(now, now.AddDays(14)); // 14 days is the max duration of a certificate for this
195-
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx));
195+
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx), password: null);
196196

197197
// Save
198198
store.Add(cert);

src/Servers/Kestrel/samples/WebTransportSampleApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static X509Certificate2 GenerateManualCertificate()
7878
req.CertificateExtensions.Add(sanBuilder.Build());
7979
// Sign
8080
using var crt = req.CreateSelfSigned(now, now.AddDays(14)); // 14 days is the max duration of a certificate for this
81-
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx));
81+
cert = X509CertificateLoader.LoadPkcs12(crt.Export(X509ContentType.Pfx), password: null);
8282

8383
// Save
8484
store.Add(cert);

src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public async Task HttpOptionsSetOntoHttpClientHandler()
9191
return testHttpHandler;
9292
};
9393
httpOptions.Cookies.Add(new Cookie("Name", "Value", string.Empty, "fakeuri.org"));
94-
var clientCertificate = new X509Certificate(Array.Empty<byte>());
94+
var clientCertificate = X509CertificateLoader.LoadCertificate(Array.Empty<byte>());
9595
httpOptions.ClientCertificates.Add(clientCertificate);
9696
httpOptions.UseDefaultCredentials = false;
9797
httpOptions.Credentials = Mock.Of<ICredentials>();

src/SignalR/server/SignalR/test/Microsoft.AspNetCore.SignalR.Tests/WebSocketsTransportTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task HttpOptionsSetOntoWebSocketOptions()
3131

3232
var httpOptions = new HttpConnectionOptions();
3333
httpOptions.Cookies.Add(new Cookie("Name", "Value", string.Empty, "fakeuri.org"));
34-
var clientCertificate = new X509Certificate(Array.Empty<byte>());
34+
var clientCertificate = X509CertificateLoader.LoadCertificate(Array.Empty<byte>());
3535
httpOptions.ClientCertificates.Add(clientCertificate);
3636
httpOptions.UseDefaultCredentials = false;
3737
httpOptions.Credentials = Mock.Of<ICredentials>();

0 commit comments

Comments
 (0)