Skip to content

Commit 4026b59

Browse files
author
Vadims Podans
committed
Initial commit
1 parent d45c6f7 commit 4026b59

38 files changed

+4551
-0
lines changed

.gitattributes

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

Asn1Parser.sln

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asn1Parser", "Asn1Parser\Asn1Parser.csproj", "{F18F1812-FD65-4206-8869-B1DBB4D59AC8}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asn1ParserTests", "Asn1ParserTests\Asn1ParserTests.csproj", "{56F7C33E-12EB-4685-B514-64384F747E95}"
9+
EndProject
10+
Global
11+
GlobalSection(TeamFoundationVersionControl) = preSolution
12+
SccNumberOfProjects = 3
13+
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
14+
SccTeamFoundationServer = https://pspkix.visualstudio.com/defaultcollection
15+
SccLocalPath0 = .
16+
SccProjectUniqueName1 = Asn1Parser\\Asn1Parser.csproj
17+
SccProjectName1 = Asn1Parser
18+
SccLocalPath1 = Asn1Parser
19+
SccProjectUniqueName2 = Asn1ParserTests\\Asn1Parser.csproj
20+
SccProjectName2 = Asn1ParserTests
21+
SccLocalPath2 = Asn1ParserTests
22+
EndGlobalSection
23+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
24+
Debug|Any CPU = Debug|Any CPU
25+
Release|Any CPU = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28+
{F18F1812-FD65-4206-8869-B1DBB4D59AC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{F18F1812-FD65-4206-8869-B1DBB4D59AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{F18F1812-FD65-4206-8869-B1DBB4D59AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{F18F1812-FD65-4206-8869-B1DBB4D59AC8}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{56F7C33E-12EB-4685-B514-64384F747E95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{56F7C33E-12EB-4685-B514-64384F747E95}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{56F7C33E-12EB-4685-B514-64384F747E95}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{56F7C33E-12EB-4685-B514-64384F747E95}.Release|Any CPU.Build.0 = Release|Any CPU
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
EndGlobal

Asn1Parser/Asn1Class.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace SysadminsLV.Asn1Parser {
2+
/// <summary>
3+
/// Defines ASN.1 tagging classes.
4+
/// </summary>
5+
public enum Asn1Class : byte {
6+
/// <summary>
7+
/// Represents Universal tag class.
8+
/// </summary>
9+
UNIVERSAL = 0, // 0x00
10+
/// <summary>
11+
/// Represents Constructed tag class.
12+
/// </summary>
13+
CONSTRUCTED = 32, // 0x20
14+
/// <summary>
15+
/// Represents Application tag class.
16+
/// </summary>
17+
APPLICATION = 64, // 0x40
18+
/// <summary>
19+
/// <strong>CONTEXT-SPECIFIC</strong> distinguishes members of a sequence or set, the alternatives of a CHOICE, or
20+
/// universally tagged set members.
21+
/// </summary>
22+
CONTEXT_SPECIFIC = 128, // 0x80
23+
/// <summary>
24+
/// Represents Private tag class.
25+
/// </summary>
26+
PRIVATE = 192 // 0xc0
27+
}
28+
}

Asn1Parser/Asn1InvalidTagException.cs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
using System.Runtime.Serialization;
4+
5+
namespace SysadminsLV.Asn1Parser {
6+
/// <summary>
7+
///
8+
/// </summary>
9+
[Serializable]
10+
[ComVisible(true)]
11+
public sealed class Asn1InvalidTagException : Exception {
12+
public Asn1InvalidTagException()
13+
: base("ASN1 bad tag value met.") {
14+
HResult = unchecked((Int32)0x8009310b);
15+
}
16+
public Asn1InvalidTagException(String message) : base(message) {
17+
HResult = unchecked((Int32)0x8009310b);
18+
}
19+
public Asn1InvalidTagException(Int32 offset)
20+
: base(String.Format("ASN1 bad tag value met at offset:{0}.", offset)) {
21+
HResult = unchecked((Int32)0x8009310b);
22+
Offset = offset;
23+
}
24+
public Asn1InvalidTagException(Exception innerException)
25+
: base("ASN1 bad tag value met.", innerException) {
26+
HResult = unchecked((Int32)0x8009310b);
27+
}
28+
/// <param name="message">The error message that explains the reason for the exception.</param>
29+
/// <param name="innerException">
30+
/// The exception that is the cause of the current exception. If the <strong>innerException</strong> parameter is not a null
31+
/// reference, the current exception is raised in a catch block that handles the inner exception.
32+
/// </param>
33+
public Asn1InvalidTagException(String message, Exception innerException) : base(message, innerException) { }
34+
/// <param name="info">The object that holds the serialized object data.</param>
35+
/// <param name="context">The contextual information about the source or destination.</param>
36+
/// <remarks>This constructor is called during deserialization to reconstitute the exception object transmitted over a stream.</remarks>
37+
public Asn1InvalidTagException(SerializationInfo info, StreamingContext context) : base(info, context) { }
38+
/// <summary>
39+
/// Gets the offset at which invalid ASN tag appear.
40+
/// </summary>
41+
public Int32 Offset { get; private set; }
42+
}
43+
}

Asn1Parser/Asn1Parser.csproj

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{F18F1812-FD65-4206-8869-B1DBB4D59AC8}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>SysadminsLV.Asn1Parser</RootNamespace>
11+
<AssemblyName>SysadminsLV.Asn1Parser</AssemblyName>
12+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SccProjectName>SAK</SccProjectName>
15+
<SccLocalPath>SAK</SccLocalPath>
16+
<SccAuxPath>SAK</SccAuxPath>
17+
<SccProvider>SAK</SccProvider>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<PropertyGroup>
37+
<SignAssembly>false</SignAssembly>
38+
</PropertyGroup>
39+
<PropertyGroup>
40+
<AssemblyOriginatorKeyFile>
41+
</AssemblyOriginatorKeyFile>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<Reference Include="System" />
45+
<Reference Include="System.Core" />
46+
<Reference Include="System.Numerics" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<Compile Include="Tree\IAsn1Tree.cs" />
50+
<Compile Include="CLRExtensions\Generics\ObservableList.cs" />
51+
<Compile Include="Asn1Reader.cs" />
52+
<Compile Include="Asn1Class.cs" />
53+
<Compile Include="Asn1Type.cs" />
54+
<Compile Include="Asn1Utils.cs" />
55+
<Compile Include="AsnFormatter.cs" />
56+
<Compile Include="Asn1InvalidTagException.cs" />
57+
<Compile Include="CLRExtensions\BigInteger2.cs" />
58+
<Compile Include="EncodingFormat.cs" />
59+
<Compile Include="EncodingType.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
<Compile Include="Tree\Asn1Tree.cs" />
62+
<Compile Include="Tree\Asn1Node.cs" />
63+
<Compile Include="Tree\GenericAsn1Tree.cs" />
64+
<Compile Include="Tree\IAsn1NodeValue.cs" />
65+
<Compile Include="Tree\InsertNodeOption.cs" />
66+
<Compile Include="Universal\Asn1BitString.cs" />
67+
<Compile Include="Universal\Asn1BmpString.cs" />
68+
<Compile Include="Universal\Asn1GeneralizedTime.cs" />
69+
<Compile Include="Universal\Asn1IA5String.cs" />
70+
<Compile Include="Universal\Asn1Integer.cs" />
71+
<Compile Include="Universal\Asn1NumericString.cs" />
72+
<Compile Include="Universal\Asn1ObjectIdentifier.cs" />
73+
<Compile Include="Universal\Asn1PrintableString.cs" />
74+
<Compile Include="Universal\Asn1TeletexString.cs" />
75+
<Compile Include="Universal\Asn1UniversalString.cs" />
76+
<Compile Include="Universal\Asn1UtcTime.cs" />
77+
<Compile Include="Universal\Asn1UTF8String.cs" />
78+
<Compile Include="Universal\Asn1VisibleString.cs" />
79+
<Compile Include="Universal\UniversalTagBase.cs" />
80+
<Compile Include="Utils\AsnInternalMap.cs" />
81+
<Compile Include="Utils\DateTimeUtils.cs" />
82+
<Compile Include="Utils\Strings.cs" />
83+
<Compile Include="Utils\StringUtils.cs" />
84+
</ItemGroup>
85+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
86+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
87+
Other similar extension points exist, see Microsoft.Common.targets.
88+
<Target Name="BeforeBuild">
89+
</Target>
90+
<Target Name="AfterBuild">
91+
</Target>
92+
-->
93+
</Project>

0 commit comments

Comments
 (0)