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

Usage of obsolete X509Certificate2 constructor #21839

Closed
1 task done
ThiBsc opened this issue Jan 7, 2025 · 0 comments
Closed
1 task done

Usage of obsolete X509Certificate2 constructor #21839

ThiBsc opened this issue Jan 7, 2025 · 0 comments
Assignees
Milestone

Comments

@ThiBsc
Copy link

ThiBsc commented Jan 7, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Description

Since .NET 9 Preview 7, the X509Certificate2 constructor is marked as obsolete (source. Microsoft doc here)

And the source when created new project with the latest version of the abp cli still uses it.

Reproduction Steps

Start a new Abp project from cli, for example with this following command line

abp new Acme.BookStore -u blazor -m none --theme leptonx-lite -csf

Expected behavior

The code should use the workaround in the microsoft doc page (here)

var certificate = flag != null
    ? X509CertificateLoader.LoadPkcs12FromFile("mypath", "mypassword", flag);
    : X509CertificateLoader.LoadPkcs12FromFile("mypath", "mypassword");

Actual behavior

The code is created with the obsolete constructor

var certificate = flag != null
    ? new X509Certificate2(fileName, passPhrase, flag.Value)
    : new X509Certificate2(fileName, passPhrase);

Regression?

No response

Known Workarounds

https://learn.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslib0057#workaround

Version

9.0.3

User Interface

Common (Default)

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants