Skip to content

Commit 73b318b

Browse files
authored
Actually assign loaded cert when generating pfx (#1609)
* Actually assign loaded cert when generating pfx * Enable tests that would have caught this issue
1 parent f7e7613 commit 73b318b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/KubernetesClient/CertUtils.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static X509Certificate2 GeneratePfx(KubernetesClientConfiguration config)
8181
if (config.ClientCertificateKeyStoreFlags.HasValue)
8282
{
8383
#if NET9_0_OR_GREATER
84-
X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword, config.ClientCertificateKeyStoreFlags.Value);
84+
cert = X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword, config.ClientCertificateKeyStoreFlags.Value);
8585
#else
8686
cert = new X509Certificate2(cert.Export(X509ContentType.Pkcs12), nullPassword, config.ClientCertificateKeyStoreFlags.Value);
8787
#endif
@@ -90,7 +90,7 @@ public static X509Certificate2 GeneratePfx(KubernetesClientConfiguration config)
9090
else
9191
{
9292
#if NET9_0_OR_GREATER
93-
X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword);
93+
cert = X509CertificateLoader.LoadPkcs12(cert.Export(X509ContentType.Pkcs12), nullPassword);
9494
#else
9595
cert = new X509Certificate2(cert.Export(X509ContentType.Pkcs12), nullPassword);
9696
#endif

tests/KubernetesClient.Tests/AuthTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ public void BasicAuth()
167167
}
168168
}
169169

170-
// this test doesn't work on OSX and is inconsistent on windows
171-
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX | OperatingSystems.Windows)]
170+
// this test doesn't work on OSX
171+
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX)]
172172
public void Cert()
173173
{
174174
var serverCertificateData = File.ReadAllText("assets/apiserver-pfx-data.txt");
@@ -273,7 +273,7 @@ public void Cert()
273273
}
274274
}
275275

276-
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX | OperatingSystems.Windows)]
276+
[OperatingSystemDependentFact(Exclude = OperatingSystems.OSX)]
277277
public void ExternalCertificate()
278278
{
279279
const string name = "testing_irrelevant";

0 commit comments

Comments
 (0)