Egov.Extensions.Configuration
8.0.3
dotnet add package Egov.Extensions.Configuration --version 8.0.3
NuGet\Install-Package Egov.Extensions.Configuration -Version 8.0.3
<PackageReference Include="Egov.Extensions.Configuration" Version="8.0.3" />
<PackageVersion Include="Egov.Extensions.Configuration" Version="8.0.3" />
<PackageReference Include="Egov.Extensions.Configuration" />
paket add Egov.Extensions.Configuration --version 8.0.3
#r "nuget: Egov.Extensions.Configuration, 8.0.3"
#:package Egov.Extensions.Configuration@8.0.3
#addin nuget:?package=Egov.Extensions.Configuration&version=8.0.3
#tool nuget:?package=Egov.Extensions.Configuration&version=8.0.3
Egov Configuration Extension
This package provides helpers for certificate loading and configuring IOptions<SystemCertificateOptions> in ASP.NET Core 8.0+ applications. This is a base library that serves as a foundation for other NuGet packages in the Egov ecosystem, providing shared certificate management functionality.
Getting Started
Please go through the following instructions to integrate certificate loading into your project.
Prerequisites
Before using this package, ensure you have:
- A valid certificate file (PFX, CER, or PEM format)
- Access to the certificate password if the certificate is password-protected
- For Kubernetes deployments, certificates mounted as secrets with
tls.crtandtls.keyfiles
Installing
Install the following package from NuGet
Install-Package Egov.Extensions.Configuration
Then follow the instructions from Configuration and Usage sections below.
Configuration
Add the following configuration section to your appsettings.json:
{
...
"Certificate": {
"Path": "Files\\Certificates\\yourcertificate.pfx",
"Password": "yourcertificatepassword"
}
...
}
Path can be:
- A path to a PFX file (requires Password)
- A path to a CER file (for public certificates only)
- A path to a directory containing
tls.crtandtls.keyfiles (for Kubernetes mounted secrets)
Password is optional and only required for encrypted PFX files or encrypted PEM private keys.
Usage
Using Dependency Injection (Recommended)
Add the following code snippet to your Program.cs or Startup.ConfigureServices method:
builder.Services.AddSystemCertificate(builder.Configuration.GetSection("Certificate"));
Then inject IOptions<SystemCertificateOptions> or IOptionsSnapshot<SystemCertificateOptions> into your services:
public class MyService
{
private readonly SystemCertificateOptions _certificateOptions;
public MyService(IOptions<SystemCertificateOptions> certificateOptions)
{
_certificateOptions = certificateOptions.Value;
}
public void UseCertificate()
{
var certificate = _certificateOptions.Certificate;
// Use the certificate...
}
}
Using CertificateLoader Directly
You can also use the CertificateLoader class directly without dependency injection:
Loading a public certificate:
var certificate = CertificateLoader.Public("path/to/certificate.cer");
Loading a private certificate:
var certificate = CertificateLoader.Private("path/to/certificate.pfx", "password");
Loading from Kubernetes mounted secret:
var certificate = CertificateLoader.Private("/etc/ssl/certs", null);
The CertificateLoader automatically handles:
- Loading certificates from PFX files
- Loading certificates from CER files
- Loading certificates from PEM files (including certificate chains)
- Loading certificates from Kubernetes mounted secrets (
tls.crtandtls.key) - Installing intermediate certificates into the certificate store
Supported Certificate Formats
- PFX/PKCS#12: Password-protected certificate with private key
- CER: Public certificate file
- PEM: Certificate chain files (supports
tls.crtandtls.keyfor Kubernetes)
Error Handling
If the certificate cannot be loaded or does not contain a private key (when required), the package will throw an InvalidOperationException with an appropriate error message.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Egov.Extensions.Configuration:
| Package | Downloads |
|---|---|
|
Egov.Integrations.MPass.Saml
This package contains an authentication handler for MPass implementing SAML 2.0 protocol for ASP.NET Core. |
|
|
Egov.Integrations.MSign.Soap
A reusable library to connect with MSign. Usage: in Startup.cs on ConfigureServices add services.AddMSignSoapClient(Configuration.GetSection("MSignSoap")); |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.3 | 225 | 12/12/2025 |