Skip to content

Added Span<T> and Memory<T> support #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 66 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9ff32a2
added support for c# Span<T> type by adding new methods that return S…
Crypt32 Dec 10, 2024
5f34a08
updated AsnFormatter by using Span<T> and added new BinaryToString o…
Crypt32 Dec 10, 2024
8822573
added Asn1Utils.Encode overload that accepts and returns Span<T>
Crypt32 Dec 10, 2024
dc1d5ad
updated Asn1Utils by using new span-based formatter
Crypt32 Dec 10, 2024
b7b3b0c
fixed xml-docs by pointing to right overload.
Crypt32 Dec 10, 2024
7f1afe1
updated xml-docs
Crypt32 Dec 10, 2024
deba555
added Asn1Universal.GetRawDataAsSpan method
Crypt32 Dec 10, 2024
60c502a
changed Span to ReadOnlySpan as it should be immutable
Crypt32 Dec 10, 2024
f880d47
replaced Span with Memory
Crypt32 Dec 11, 2024
6ee6eb3
added faster implementation of BinaryToStringFormatter.ToBase64, whic…
Crypt32 Dec 11, 2024
4bb52b0
fixed null checking for struct, which is never null
Crypt32 Dec 11, 2024
8c3c543
optimized conditions and removed duplicate code
Crypt32 Dec 11, 2024
864d1e4
added few more tests
Crypt32 Dec 11, 2024
c1e7725
added quick benchmark project to test implementations. Nothing fancy …
Crypt32 Dec 11, 2024
e4d9b0e
addressed #22
Crypt32 Dec 12, 2024
271214b
improved BinaryToStringFormatter.ToHexAddress performance by pre-allo…
Crypt32 Dec 12, 2024
0c2761c
refactored benchmarks
Crypt32 Dec 12, 2024
6649e8e
refactored some static methods to extension methods.
Crypt32 Dec 12, 2024
e7ebea9
fixed class visibility
Crypt32 Dec 12, 2024
da53b87
refactored classes that inherit from Asn1String by moving shared func…
Crypt32 Feb 20, 2025
4612795
moved from .NET Standard to .NET 8.0 by keeping compat with .NET Fram…
Crypt32 Feb 20, 2025
76d2035
refactored Encode method
Crypt32 Feb 25, 2025
579f153
added few more Obsolete attributes and better way to get a copy of AS…
Crypt32 Feb 25, 2025
d3b6aa7
updated ASN1 builder to support ReadOnlyMemory. Still need some work.
Crypt32 Feb 25, 2025
ef343f9
added support for ReadOnlyMemory in ASN.1 type decoders
Crypt32 Feb 25, 2025
72be4cb
added protected access to internal reader
Crypt32 Feb 25, 2025
33f2f0f
refactored Asn1OctetString to support ReadOnlyMemory.
Crypt32 Feb 25, 2025
9989441
fixed bug in Asn1Builder.getEncoded when outer tag is not copied to t…
Crypt32 Feb 25, 2025
8905c9b
typo
Crypt32 Feb 25, 2025
ba0d21f
added Obsolete attribute
Crypt32 Feb 25, 2025
0907e20
added new overload to Create method that accepts ReadOnlyMemory
Crypt32 Feb 25, 2025
a6f7d1c
added xml-doc for FlagsAttribute
Crypt32 Feb 25, 2025
f7c80e6
replaced Asn1Universal.IsContainer with Asn1Universal.IsConstructed
Crypt32 Feb 25, 2025
44251ec
added missing xml-doc
Crypt32 Feb 25, 2025
b768105
ensure that all ASN type decoders have constructor that accepts ReadO…
Crypt32 Feb 25, 2025
9ca789a
added new EncodeAsReader method which eliminates duplicate reader ins…
Crypt32 Feb 25, 2025
08db279
deprecated Asn1Reader(Byte[]) ctor and updated usages
Crypt32 Feb 25, 2025
bf9272c
removed all methods that accept byte arrays as parameter
Crypt32 Feb 25, 2025
745dbfd
moved xmld-doc to appropriate class
Crypt32 Feb 25, 2025
e013f77
refactored Asn1Utils by ensuring that methods accept ReadOnlySpan as …
Crypt32 Feb 25, 2025
9a20e1e
removed constructors from ASN.1 decoders that accept pure byte arrays…
Crypt32 Feb 25, 2025
21297f7
- removed redundant null checks
Crypt32 Feb 26, 2025
0979941
adjusted null syntax
Crypt32 Feb 26, 2025
1938428
fixed raw data source
Crypt32 Feb 26, 2025
5ce482b
clarified the meaning of Asn1Reader.GetReader() method
Crypt32 Feb 26, 2025
071f4c4
added Asn1Reader.Clone() method
Crypt32 Feb 26, 2025
7b81f7f
optimized Asn1Reader.Clone() method
Crypt32 Feb 26, 2025
95d2df6
updated .nuspec file
Crypt32 Feb 26, 2025
af7b40b
shortened .NET Framework version
Crypt32 Feb 26, 2025
4d35b7e
bump to v2.0.0
Crypt32 Feb 26, 2025
2d5a638
removed Asn1Builder.Create(IEnumerable<Byte>) method
Crypt32 Feb 28, 2025
53ff126
fixed ASN.1 builder encoder bugs
Crypt32 Mar 3, 2025
b2de43c
fixed bug in Asn1BitString.GetValue() which returns unused bit byte
Crypt32 Mar 3, 2025
9c09c8b
fixed bug when Convert.ToUInt64 fails to convert BigInteger, because …
Crypt32 Mar 3, 2025
9c1e59e
added missing default value for Asn1Builder.GetEncodedAsMemory() meth…
Crypt32 Mar 3, 2025
00275fd
added some unit tests for Asn1Builder class
Crypt32 Mar 3, 2025
100dc87
added Asn1Universal.GetPayloadAsMemory() method.
Crypt32 Mar 3, 2025
8ab6f2c
Significantly reworked Base64 to string conversion which addresses #2…
Crypt32 Mar 6, 2025
2703e5b
removed redundant `.AsSpan()` calls.
Crypt32 Mar 6, 2025
8f36ccc
Refactored BinaryToHexStringTests
Crypt32 Mar 6, 2025
c6bdf9b
added Asn1BitString tests
Crypt32 Mar 14, 2025
60cccfb
Added Asn1Utils.GetLengthBytesAsMemory which is identical to Asn1Util…
Crypt32 Mar 14, 2025
5041af1
fixed #25
Crypt32 Mar 14, 2025
b603668
significantly simplified Asn1Utils.Encode method.
Crypt32 Mar 14, 2025
e995801
minor refactoring
Crypt32 Mar 14, 2025
5106865
added unit tests for core methods of Asn1Utils class.
Crypt32 Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Asn1Parser.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CA656832
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Asn1Parser.Tests", "tests\Asn1Parser.Tests\Asn1Parser.Tests.csproj", "{739EADA6-013A-4BA3-BF41-70D667B9682A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Asn1Parser.Benchmark", "tests\Asn1Parser.Benchmark\Asn1Parser.Benchmark.csproj", "{492FCE10-32C2-4485-A529-CC08AF075D5A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,12 +30,17 @@ Global
{739EADA6-013A-4BA3-BF41-70D667B9682A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{739EADA6-013A-4BA3-BF41-70D667B9682A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{739EADA6-013A-4BA3-BF41-70D667B9682A}.Release|Any CPU.Build.0 = Release|Any CPU
{492FCE10-32C2-4485-A529-CC08AF075D5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{492FCE10-32C2-4485-A529-CC08AF075D5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{492FCE10-32C2-4485-A529-CC08AF075D5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{492FCE10-32C2-4485-A529-CC08AF075D5A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{739EADA6-013A-4BA3-BF41-70D667B9682A} = {CA656832-2531-426B-ACF5-724FA0A6EDC7}
{492FCE10-32C2-4485-A529-CC08AF075D5A} = {CA656832-2531-426B-ACF5-724FA0A6EDC7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B1F6FDE1-A4A9-4257-82D9-2CFC87B32B09}
Expand Down
252 changes: 134 additions & 118 deletions Asn1Parser/Asn1Builder.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Asn1Parser/Asn1InvalidTagException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public Asn1InvalidTagException(String message, Exception innerException) : base(
/// <param name="info">The object that holds the serialized object data.</param>
/// <param name="context">The contextual information about the source or destination.</param>
/// <remarks>This constructor is called during deserialization to reconstitute the exception object transmitted over a stream.</remarks>
[Obsolete("This overload is obsolete by SYSLIB0051.", true)]
public Asn1InvalidTagException(SerializationInfo info, StreamingContext context) : base(info, context) { }
/// <summary>
/// Gets the offset at which invalid ASN tag appear.
Expand Down
15 changes: 9 additions & 6 deletions Asn1Parser/Asn1Parser.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Version>1.3.0</Version>
<Version>2.0.0</Version>
<AssemblyName>SysadminsLV.Asn1Parser</AssemblyName>
<RootNamespace>SysadminsLV.Asn1Parser</RootNamespace>

Expand All @@ -15,15 +15,18 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<Nullable>enable</Nullable>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>strongname.snk</AssemblyOriginatorKeyFile>
<!--<AssemblyOriginatorKeyFile>strongname.snk</AssemblyOriginatorKeyFile>-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|netstandard2.0'">
<DocumentationFile>bin\Release\netstandard2.0\SysadminsLV.Asn1Parser.xml</DocumentationFile>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net8.0'">
<DocumentationFile>bin\Release\net8.0\SysadminsLV.Asn1Parser.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net472'">
<DocumentationFile>bin\Release\net472\SysadminsLV.Asn1Parser.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
</Project>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.6.0" />
</ItemGroup>
</Project>
Loading