Skip to content

Commit d080825

Browse files
use x509 loader in net9, skip diagnostics in net9
1 parent fcbd10c commit d080825

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Certify.CLI/CertifyCLI.RunCertDiagnostics.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static bool isNumeric(string input)
112112
}
113113
}
114114

115+
#if !NET9_0_OR_GREATER
115116
if (!string.IsNullOrEmpty(site.CertificatePath) && System.IO.File.Exists(site.CertificatePath))
116117
{
117118
Console.WriteLine($"{site.Name}");
@@ -136,6 +137,7 @@ static bool isNumeric(string input)
136137
Console.WriteLine("\t Access: " + a.IdentityReference.Value.ToString());
137138
}
138139
}
140+
139141
}
140142

141143
if (includeOcspCheck)
@@ -212,7 +214,7 @@ static bool isNumeric(string input)
212214
}
213215
}
214216
}
215-
217+
#endif
216218
Debug.WriteLine($"Item update took {itemTiming.Elapsed.TotalSeconds}s");
217219
}
218220

src/Certify.Providers/ACME/Anvil/AnvilACMEProvider.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,11 @@ public async Task<ProcessStepResult> CompleteCertificateRequest(ILog log, Manage
15941594

15951595
certificateChain = await orderContext.Download(preferredChain);
15961596

1597+
#if NET9_0_OR_GREATER
1598+
cert = X509CertificateLoader.LoadCertificate(certificateChain.Certificate.ToDer());
1599+
#else
15971600
cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(certificateChain.Certificate.ToDer());
1601+
#endif
15981602

15991603
certExpiration = cert.NotAfter;
16001604
certFriendlyName += $"{cert.GetEffectiveDateString()} to {cert.GetExpirationDateString()}";

0 commit comments

Comments
 (0)