Skip to content
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

Don't use obsolete X509Certificate2 ctor #15168

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,11 @@ internal PublishArtifactsInManifestBase ConstructPublishingV3Task(BuildModel bui
SkipSafetyChecks = this.SkipSafetyChecks,
AkaMSClientId = this.AkaMSClientId,
AkaMSClientCertificate = !string.IsNullOrEmpty(AkaMSClientCertificate) ?
#pragma warning disable SYSLIB0057 // https://github.com/dotnet/arcade/issues/14936
#if NET9_0_OR_GREATER
X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate)), password: null) : null,
#else
new X509Certificate2(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate))) : null,
#pragma warning restore
#endif
AkaMSCreatedBy = this.AkaMSCreatedBy,
AkaMSGroupOwner = this.AkaMSGroupOwner,
AkaMsOwners = this.AkaMsOwners,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ protected AkaMSLinkManager CreateAkaMSLinksManager()
AkaMSLinkManager manager;
if (!string.IsNullOrEmpty(ClientCertificate))
{
#pragma warning disable SYSLIB0057 // https://github.com/dotnet/arcade/issues/14936
#if NET9_0_OR_GREATER
manager = new AkaMSLinkManager(ClientId, X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(ClientCertificate)), password: null), Tenant, Log);
#else
manager = new AkaMSLinkManager(ClientId, new X509Certificate2(Convert.FromBase64String(File.ReadAllText(ClientCertificate))), Tenant, Log);
#pragma warning restore
#endif
}
else if (!string.IsNullOrEmpty(ClientSecret))
{
Expand Down
Loading