Nyamikan.Asn1PKCS 0.2.0

dotnet add package Nyamikan.Asn1PKCS --version 0.2.0
NuGet\Install-Package Nyamikan.Asn1PKCS -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nyamikan.Asn1PKCS" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Nyamikan.Asn1PKCS --version 0.2.0
#r "nuget: Nyamikan.Asn1PKCS, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Nyamikan.Asn1PKCS as a Cake Addin
#addin nuget:?package=Nyamikan.Asn1PKCS&version=0.2.0

// Install Nyamikan.Asn1PKCS as a Cake Tool
#tool nuget:?package=Nyamikan.Asn1PKCS&version=0.2.0

Asn1PKCS

PKCS #1/PKCS #8 RSA key ASN.1 encoder/decoder for C#.

Requirements

  • .NET 6

Usage

string derBase64EncodedString = "MEgCQQDOncyWnMXJmnkc5bqmRv5+x/KKes5uBHkoi1rywCLg4YJ1d+BvXSJbQ+bQdEWcporNeYo8hYLIQHZUz1SLiZKZAgMBAAE=";

RSAParameters rsaParameters = PKCS1DERDecoder.DecodePublicKey(derBase64EncodedString);
// rsaParameters.Modulus: byte[] { 0xCE, 0x9D, 0xCC, 0x96, 0x9C, 0xC5, 0xC9, 0x9A, 0x79, 0x1C, 0xE5, 0xBA, 0xA6, 0x46, 0xFE, 0x7E, 0xC7, 0xF2, 0x8A, 0x7A, 0xCE, 0x6E, 0x04, 0x79, 0x28, 0x8B, 0x5A, 0xF2, 0xC0, 0x22, 0xE0, 0xE1, 0x82, 0x75, 0x77, 0xE0, 0x6F, 0x5D, 0x22, 0x5B, 0x43, 0xE6, 0xD0, 0x74, 0x45, 0x9C, 0xA6, 0x8A, 0xCD, 0x79, 0x8A, 0x3C, 0x85, 0x82, 0xC8, 0x40, 0x76, 0x54, 0xCF, 0x54, 0x8B, 0x89, 0x92, 0x99 }
// rsaParameters.Exponent: byte[] { 0x01, 0x00, 0x01 }
RSAParameters rsaParameters = new RSAParameters();
rsaParameters.Modulus = new byte[] { 0xBE, 0x7D, 0xF2, 0xE9, 0x01, 0xCA, 0x41, 0x62, 0x6F, 0x1B, 0x88, 0x8A, 0xB9, 0x65, 0x95, 0x16, 0x25, 0x69, 0xDF, 0xC9, 0xB2, 0x48, 0x3D, 0x96, 0x65, 0x75, 0x13, 0x4D, 0x70, 0x52, 0x19, 0xF0, 0x52, 0xEC, 0xF4, 0x6E, 0xDA, 0x02, 0x76, 0x2C, 0x08, 0xB5, 0xB3, 0x8F, 0x5D, 0x76, 0x99, 0x1D };
rsaParameters.Exponent = new byte[] { 0x11 };

string derBase64EncodedString = PKCS8DEREncoder.EncodePublicKeyToBase64(rsaParameters);
// derBase64EncodedString: "MEowDQYJKoZIhvcNAQEBBQADOQAwNgIxAL598ukBykFibxuIirlllRYlad/Jskg9lmV1E01wUhnwUuz0btoCdiwItbOPXXaZHQIBEQ=="

Other examples: https://github.com/typewriter/Asn1PKCS/tree/master/Asn1PKCSTest

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 180 5/6/2023
0.1.1 3,125 2/7/2019

Changed to .NET 6 framework