Codemations.Asn1 1.0.1

dotnet add package Codemations.Asn1 --version 1.0.1
                    
NuGet\Install-Package Codemations.Asn1 -Version 1.0.1
                    
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="Codemations.Asn1" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Codemations.Asn1" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Codemations.Asn1" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Codemations.Asn1 --version 1.0.1
                    
#r "nuget: Codemations.Asn1, 1.0.1"
                    
#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.
#addin nuget:?package=Codemations.Asn1&version=1.0.1
                    
Install Codemations.Asn1 as a Cake Addin
#tool nuget:?package=Codemations.Asn1&version=1.0.1
                    
Install Codemations.Asn1 as a Cake Tool

Nuget Build Status Quality Gate Status

Serialization/Deserialization with Codemations.Asn1

Example class ^1:

[AsnSequence]
public class FooQuestion
{
    [AsnTag]
    public BigInteger TrackingNumber { get; set; }
    [AsnTag]
    public string Question { get; set; }
}

Serialization:

var myQuestion = new FooQuestion
{
    TrackingNumber = 5,
    Question = "Anybody there?"
};
AsnSerializer.Serialize(myQuestion, AsnEncodingRules.DER);

Output (hex):

30, 13,
    02, 01, 05,
    16, 0e, 41, 6e, 79, 62, 6f, 64, 79, 20, 74, 68, 65, 72, 65, 3f

Deserialization:

var encodedData = new byte[] {
    0x30, 0x13, 0x02, 0x01, 0x05, 0x16, 0x0e, 0x41, 0x6e, 0x79, 0x62, 0x6f, 0x64, 0x79, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x3f
};

AsnSerializer.Deserialize<FooQuestion>(encodedData, AsnEncodingRules.DER);

Built-in types mapping

.NET Type ASN.1 Type Description
bool BOOLEAN Represents a true or false value.
byte INTEGER Unsigned integer (8-bit).
sbyte INTEGER Signed integer (8-bit).
short INTEGER Signed integer (16-bit).
ushort INTEGER Unsigned integer (16-bit).
int INTEGER Signed integer (32-bit).
uint INTEGER Unsigned integer (32-bit).
long INTEGER Signed integer (64-bit).
ulong INTEGER Unsigned integer (64-bit).
BigInteger INTEGER Arbitrary-precision integer.
string OBJECT IDENTIFIER UTF-8 encoded string.
byte[] OCTET STRING A sequence of bytes.
T[] (except byte[]) SEQUENCE OF A sequence of elements of type T.
List<T> SEQUENCE OF A sequence of elements of type T.
class [^2] CHOICE A choice of elements.
record [^2] CHOICE A choice of elements.
class SEQUENCE A sequence of elements.
record SEQUENCE A sequence of elements.

[^2]: with AsnPolymorphicChoice or AsnChoice attribute

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 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. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 96 1/20/2025
0.4.0 545 7/29/2022
0.3.0 412 7/26/2022
0.2.0 420 6/28/2022
0.1.15 434 6/24/2022
0.1.14 565 3/28/2022
0.1.13 434 3/27/2022
0.1.12 425 3/27/2022
0.1.11 447 3/24/2022
0.1.10 425 3/21/2022
0.1.9 436 3/20/2022
0.1.8 425 3/20/2022
0.1.2 424 3/18/2022