Tago.Extensions.Security.Certificates
                               
                            
                                3.1.1-preview-20250701-01
                            
                        
                    dotnet add package Tago.Extensions.Security.Certificates --version 3.1.1-preview-20250701-01
NuGet\Install-Package Tago.Extensions.Security.Certificates -Version 3.1.1-preview-20250701-01
<PackageReference Include="Tago.Extensions.Security.Certificates" Version="3.1.1-preview-20250701-01" />
<PackageVersion Include="Tago.Extensions.Security.Certificates" Version="3.1.1-preview-20250701-01" />
<PackageReference Include="Tago.Extensions.Security.Certificates" />
paket add Tago.Extensions.Security.Certificates --version 3.1.1-preview-20250701-01
#r "nuget: Tago.Extensions.Security.Certificates, 3.1.1-preview-20250701-01"
#:package Tago.Extensions.Security.Certificates@3.1.1-preview-20250701-01
#addin nuget:?package=Tago.Extensions.Security.Certificates&version=3.1.1-preview-20250701-01&prerelease
#tool nuget:?package=Tago.Extensions.Security.Certificates&version=3.1.1-preview-20250701-01&prerelease
Tago.Extensions.Security.Certificates
Tago.Extensions.Security.Certificates is a .NET library providing cross-platform, dependency-free cryptographic certificate and key utilities. It is designed for .NET Standard 2.0 compatibility, enabling secure key import/export, certificate manipulation, and cryptographic operations without third-party libraries.
Features
- .NET Standard 2.0 Support: Works on .NET Core, .NET Framework, and modern .NET runtimes.
- Manual ASN.1 Encoding: Export/import of RSA and ECDsa keys in PKCS#1, PKCS#8, and EC formats using pure C#.
- Certificate Utilities:
- Load certificates from files, PEM, PFX, and stores
- Export public/private keys in standard formats
- Minimal, dependency-free implementation
 
- SecurityKey Integration: Helpers for JWT and cryptographic key scenarios
- Test Coverage: xUnit-based tests for all major features
Usage
Importing and Exporting Keys
using Tago.Extensions.Security.Certificates.Extensions;
// Export RSA private key (PKCS#1)
byte[] pkcs1 = rsa.ExportRSAPrivateKey();
// Export RSA private key (PKCS#8)
byte[] pkcs8 = rsa.ExportPkcs8PrivateKey();
// Export ECDsa private key (RFC 5915)
byte[] ec = ecdsa.ExportECPrivateKey();
// Export ECDsa private key (PKCS#8)
byte[] ecPkcs8 = ecdsa.ExportPkcs8PrivateKey();
Certificate Loading
using Tago.Extensions.Security.Certificates;
// Load from file or store
var cert = CertificateHelper.GetCertificateFromStore("subjectName");
var cert2 = CertificateHelper.GetCertificate("./certs/mycert.pfx", "password");
SecurityKey Utilities
using Tago.Extensions.Security.Utils;
var key = SecurityKeyUtils.GetSecurityKey("./certs/mycert.pfx", "password", "kid");
Limitations
- CopyWithPrivateKey: Not supported in .NET Standard 2.0 due to platform API limitations. Throws PlatformNotSupportedException.
- No Third-Party Dependencies: All ASN.1 and key handling is implemented in pure C#.
Building & Testing
- Clone the repository.
- Build the solution:
dotnet build src/Tago.Extensions.Security.Certificates.sln
- Run tests:
dotnet test src/xUnitTest/xUnitTest.csproj
Project Structure
- src/Tago.Extensions.Security.Certificates/— Main library
- src/xUnitTest/— Test project
- certs/— Example/test certificates
License
MIT License
Contributing
Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request.
Tago.Extensions.Security.Certificates — Secure, portable, and dependency-free cryptography for .NET.
Introduction
Tago.Extensions.Security.Certificates is a robust .NET library for cryptographic certificate and key management, designed for maximum compatibility and zero third-party dependencies. It enables secure key import/export, certificate manipulation, and cryptographic operations in .NET Standard 2.0 and later, using only built-in .NET APIs and manual ASN.1 encoding.
Getting Started
Installation
Clone or add the library to your solution. Reference the main project:
src/Tago.Extensions.Security.Certificates/Tago.Extensions.Security.Certificates.csproj
Dependencies
- .NET Standard 2.0 or higher
- No third-party cryptography libraries required
API Overview
Key Export/Import
- Export RSA and ECDsa private keys in PKCS#1, PKCS#8, and EC formats
- Export public keys in PKCS#1 format
- Manual ASN.1 encoding for all supported formats
Certificate Utilities
- Load certificates from PEM, PFX, DER, or Windows certificate store
- Export certificates and keys for use in JWT, SAML, and other security scenarios
SecurityKey Integration
- Helpers for creating Microsoft.IdentityModel.Tokens SecurityKey objects from certificates and keys
Build and Test
- Build the solution:
dotnet build src/Tago.Extensions.Security.Certificates.sln
- Run the tests:
dotnet test src/xUnitTest/xUnitTest.csproj
Example Usage
Exporting Keys
using Tago.Extensions.Security.Certificates.Extensions;
// Export RSA private key (PKCS#1)
byte[] pkcs1 = rsa.ExportRSAPrivateKey();
// Export RSA private key (PKCS#8)
byte[] pkcs8 = rsa.ExportPkcs8PrivateKey();
// Export ECDsa private key (RFC 5915)
byte[] ec = ecdsa.ExportECPrivateKey();
// Export ECDsa private key (PKCS#8)
byte[] ecPkcs8 = ecdsa.ExportPkcs8PrivateKey();
Loading Certificates
using Tago.Extensions.Security.Certificates;
// Load from file or store
var cert = CertificateHelper.GetCertificateFromStore("subjectName");
var cert2 = CertificateHelper.GetCertificate("./certs/mycert.pfx", "password");
SecurityKey Utilities
using Tago.Extensions.Security.Utils;
var key = SecurityKeyUtils.GetSecurityKey("./certs/mycert.pfx", "password", "kid");
Project Structure
- src/Tago.Extensions.Security.Certificates/— Main library
- src/xUnitTest/— Test project
- certs/— Example/test certificates
Limitations
- CopyWithPrivateKey: Not supported in .NET Standard 2.0 due to platform API limitations. Throws PlatformNotSupportedException.
- No Third-Party Dependencies: All ASN.1 and key handling is implemented in pure C#.
Contributing
Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request. All code should be dependency-free and compatible with .NET Standard 2.0 or higher.
License
MIT License
Tago.Extensions.Security.Certificates — Secure, portable, and dependency-free cryptography for .NET.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. | 
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. | 
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. | 
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. | 
| MonoAndroid | monoandroid was computed. | 
| MonoMac | monomac was computed. | 
| MonoTouch | monotouch was computed. | 
| Tizen | tizen40 was computed. tizen60 was computed. | 
| Xamarin.iOS | xamarinios was computed. | 
| Xamarin.Mac | xamarinmac was computed. | 
| Xamarin.TVOS | xamarintvos was computed. | 
| Xamarin.WatchOS | xamarinwatchos was computed. | 
- 
                                                    .NETStandard 2.0- Microsoft.Extensions.Caching.Abstractions (>= 3.1.0)
- Microsoft.Extensions.Caching.Memory (>= 3.1.0)
- Microsoft.Extensions.Logging (>= 3.0.0)
- Microsoft.IdentityModel.Tokens (>= 6.6.0)
 
- 
                                                    .NETStandard 2.1- Microsoft.Extensions.Caching.Abstractions (>= 3.1.0)
- Microsoft.Extensions.Caching.Memory (>= 3.1.0)
- Microsoft.Extensions.Logging (>= 3.0.0)
- Microsoft.IdentityModel.Tokens (>= 6.6.0)
 
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Tago.Extensions.Security.Certificates:
| Package | Downloads | 
|---|---|
| Tago.Extensions.HttpClient Http Rest helper | |
| Tago.Extensions.JwkUtils Jwk extension | |
| Tago.Extensions.AspnetCore.IndexesAsApi.Abstractions Package Description | 
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | 
|---|---|---|
| 3.1.1-preview-20250701-01 | 624 | 7/22/2025 | 
| 3.1.1-preview-20240401-01 | 1,097 | 4/30/2024 | 
| 3.1.1-preview-20240101-01 | 84 | 4/21/2024 | 
| 3.1.1-preview-20231020-01 | 530 | 11/2/2023 | 
| 3.1.1-preview-20230528-01 | 625 | 5/31/2023 | 
| 3.1.1-preview-20220516-01 | 545 | 5/16/2022 | 
| 3.1.1-preview-20220515-01 | 245 | 5/15/2022 | 
| 3.1.1-preview-20200917-01 | 1,993 | 9/17/2020 | 
| 3.1.0-preview-1103 | 2,124 | 8/2/2020 | 
| 3.1.0-preview-1102 | 428 | 7/5/2020 | 
| 3.1.0-preview-11 | 1,373 | 6/23/2020 | 
| 3.1.0-preview-10 | 480 | 6/22/2020 | 
| 3.1.0-preview-09 | 484 | 6/19/2020 | 
| 3.1.0-preview-07 | 614 | 6/19/2020 | 
| 3.1.0-preview-06 | 517 | 6/18/2020 | 
| 3.1.0-preview-05 | 473 | 6/18/2020 | 
| 3.1.0-preview-04 | 371 | 6/18/2020 | 
| 3.1.0-preview-03 | 377 | 6/18/2020 | 
| 3.1.0-preview-02 | 1,297 | 2/13/2020 | 
| 3.1.0-preview-01 | 621 | 2/5/2020 | 
| 3.0.0-preview-03 | 1,103 | 1/26/2020 | 
| 3.0.0-preview-02 | 578 | 1/10/2020 | 
| 3.0.0-preview-01 | 881 | 11/27/2019 | 
| 2.0.3-preview-03 | 674 | 9/28/2019 | 
| 2.0.3-preview-02 | 545 | 9/24/2019 | 
| 2.0.3-preview-01 | 507 | 9/24/2019 | 
| 2.0.0-preview-1 | 517 | 9/23/2019 |