OpenSSL.PrivateKeyDecoder
1.0.1
See the version list below for details.
dotnet add package OpenSSL.PrivateKeyDecoder --version 1.0.1
NuGet\Install-Package OpenSSL.PrivateKeyDecoder -Version 1.0.1
<PackageReference Include="OpenSSL.PrivateKeyDecoder" Version="1.0.1" />
paket add OpenSSL.PrivateKeyDecoder --version 1.0.1
#r "nuget: OpenSSL.PrivateKeyDecoder, 1.0.1"
// Install OpenSSL.PrivateKeyDecoder as a Cake Addin #addin nuget:?package=OpenSSL.PrivateKeyDecoder&version=1.0.1 // Install OpenSSL.PrivateKeyDecoder as a Cake Tool #tool nuget:?package=OpenSSL.PrivateKeyDecoder&version=1.0.1
OpenSSL X509Certificate2 Provider
Parses OpenSSL public and private key components and returns a X509Certificate2 with RSA/RSACryptoServiceProvider. (Based on http://www.jensign.com/opensslkey/opensslkey.cs)
Project | NuGet |
---|---|
OpenSSL.PrivateKeyDecoder | |
OpenSSL.X509Certificate2.Provider |
Support for the following frameworks:
- .NET 2.0
- .NET 3.5
- .NET 4.5 and up
- .NET Standard 1.3 (also NET Core 1.1)
- .NET Standard 2.0 (also NET Core 2.0)
Support for decoding RSA Private Key
and Private Key
.
Example
Generate public certificate + privatekey
Generate public certificate + privatekey using:
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout private.key -out certificate_pub.crt
Code example 1 - decode private key
If you just want to decode the private key into a RSACryptoServiceProvider, use the following code:
string privateKeyText = File.ReadAllText("private.key");
IOpenSSLPrivateKeyDecoder decoder = new OpenSSLPrivateKeyDecoder();
RSACryptoServiceProvider cryptoServiceProvider = decoder.Decode(privateKeyText);
// Example: sign the data
byte[] hello = new UTF8Encoding().GetBytes("Hello World");
byte[] hashValue = cryptoServiceProvider.SignData(hello, CryptoConfig.MapNameToOID("SHA256"));
// Example: use the PrivateKey from above for signing a JWT token using Jose.Jwt:
string token = Jose.JWT.Encode(payload, cryptoServiceProvider, JwsAlgorithm.RS256);
Code example 2 - Create a X509 certificate and add private key
string certificateText = File.ReadAllText("certificate_pub.crt");
string privateKeyText = File.ReadAllText("private.key");
ICertificateProvider provider = new CertificateFromFileProvider(certificateText, privateKeyText);
X509Certificate2 certificate = provider.Certificate;
// Example: use the PrivateKey from the certificate above for signing a JWT token using Jose.Jwt:
string token = Jose.JWT.Encode(payload, certificate.PrivateKey, JwsAlgorithm.RS256);
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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net20 is compatible. net35 is compatible. net40 was computed. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 2.0
- No dependencies.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- System.Security.Cryptography.Csp (>= 4.3.0)
- System.Security.SecureString (>= 4.3.0)
-
.NETStandard 2.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on OpenSSL.PrivateKeyDecoder:
Package | Downloads |
---|---|
OpenSSL.X509Certificate2.Provider
Parses OpenSSL public and private (rsa) key components and returns a X509Certificate2 with RSACryptoServiceProvider. |
|
CrossCuttingCunconers.Infrastructure
Package Description |
|
AtlassianAssistance.JiraService
https://raw.githubusercontent.com/kalhorim/JiraService/main/README.md |
|
JiraService
Jira Service 'this version is released just for test' |
|
dynamicFESiat
Componente para la integracion con la Facturacion en Linea |
GitHub repositories
This package is not used by any popular GitHub repositories.
Fixed issue (#3) and added NET Standard 2.0