initial
This commit is contained in:
BIN
packages/System.Formats.Asn1.9.0.4/.signature.p7s
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/System.Formats.Asn1.9.0.4/Icon.png
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/Icon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
23
packages/System.Formats.Asn1.9.0.4/LICENSE.TXT
vendored
Normal file
23
packages/System.Formats.Asn1.9.0.4/LICENSE.TXT
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
132
packages/System.Formats.Asn1.9.0.4/PACKAGE.md
vendored
Normal file
132
packages/System.Formats.Asn1.9.0.4/PACKAGE.md
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
## About
|
||||
|
||||
<!-- A description of the package and where one can find more documentation -->
|
||||
|
||||
Provides functionality for parsing, encoding, and decoding data using Abstract Syntax Notation One (ASN.1).
|
||||
ASN.1 is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way.
|
||||
|
||||
## Key Features
|
||||
|
||||
<!-- The key features of this package -->
|
||||
|
||||
* Parse ASN.1 data into .NET types.
|
||||
* Encode .NET types into ASN.1 format.
|
||||
* Support for BER, CER, DER: Handles Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER).
|
||||
|
||||
## How to Use
|
||||
|
||||
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
|
||||
|
||||
Parsing ASN.1 data:
|
||||
|
||||
```csharp
|
||||
using System.Formats.Asn1;
|
||||
using System.Numerics;
|
||||
|
||||
// Sample ASN.1 encoded data (DER format)
|
||||
byte[] asn1Data = [0x30, 0x09, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x03];
|
||||
|
||||
// Create an AsnReader to parse the data
|
||||
AsnReader reader = new(asn1Data, AsnEncodingRules.DER);
|
||||
|
||||
// Parse the sequence
|
||||
AsnReader sequenceReader = reader.ReadSequence();
|
||||
|
||||
// Read integers from the sequence
|
||||
BigInteger firstInt = sequenceReader.ReadInteger();
|
||||
BigInteger secondInt = sequenceReader.ReadInteger();
|
||||
BigInteger thirdInt = sequenceReader.ReadInteger();
|
||||
|
||||
Console.WriteLine($"First integer: {firstInt}");
|
||||
Console.WriteLine($"Second integer: {secondInt}");
|
||||
Console.WriteLine($"Third integer: {thirdInt}");
|
||||
|
||||
// First integer: 1
|
||||
// Second integer: 2
|
||||
// Third integer: 3
|
||||
```
|
||||
|
||||
Decoding ASN.1 data using `AsnDecoder`:
|
||||
|
||||
```csharp
|
||||
using System.Formats.Asn1;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
// Sample ASN.1 encoded data
|
||||
byte[] booleanData = [0x01, 0x01, 0xFF]; // BOOLEAN TRUE
|
||||
byte[] integerData = [0x02, 0x01, 0x05]; // INTEGER 5
|
||||
byte[] octetStringData = [0x04, 0x03, 0x41, 0x42, 0x43]; // OCTET STRING "ABC"
|
||||
byte[] objectIdentifierData = [0x06, 0x03, 0x2A, 0x03, 0x04]; // OBJECT IDENTIFIER 1.2.3.4
|
||||
byte[] utf8StringData = [0x0C, 0x05, 0x48, 0x65, 0x6C, 0x6C, 0x6F]; // UTF8String "Hello"
|
||||
|
||||
int bytesConsumed;
|
||||
|
||||
bool booleanValue = AsnDecoder.ReadBoolean(booleanData, AsnEncodingRules.DER, out bytesConsumed);
|
||||
Console.WriteLine($"Decoded BOOLEAN value: {booleanValue}, Bytes consumed: {bytesConsumed}");
|
||||
// Decoded BOOLEAN value: True, Bytes consumed: 3
|
||||
|
||||
BigInteger integerValue = AsnDecoder.ReadInteger(integerData, AsnEncodingRules.DER, out bytesConsumed);
|
||||
Console.WriteLine($"Decoded INTEGER value: {integerValue}, Bytes consumed: {bytesConsumed}");
|
||||
// Decoded INTEGER value: 5, Bytes consumed: 3
|
||||
|
||||
byte[] octetStringValue = AsnDecoder.ReadOctetString(octetStringData, AsnEncodingRules.DER, out bytesConsumed);
|
||||
Console.WriteLine($"Decoded OCTET STRING value: {Encoding.ASCII.GetString(octetStringValue)}, Bytes consumed: {bytesConsumed}");
|
||||
// Decoded OCTET STRING value: ABC, Bytes consumed: 5
|
||||
|
||||
string objectIdentifierValue = AsnDecoder.ReadObjectIdentifier(objectIdentifierData, AsnEncodingRules.DER, out bytesConsumed);
|
||||
Console.WriteLine($"Decoded OBJECT IDENTIFIER value: {objectIdentifierValue}, Bytes consumed: {bytesConsumed}");
|
||||
// Decoded OBJECT IDENTIFIER value: 1.2.3.4, Bytes consumed: 5
|
||||
|
||||
string utf8StringValue = AsnDecoder.ReadCharacterString(utf8StringData, AsnEncodingRules.DER, UniversalTagNumber.UTF8String, out bytesConsumed);
|
||||
Console.WriteLine($"Decoded UTF8String value: {utf8StringValue}, Bytes consumed: {bytesConsumed}");
|
||||
// Decoded UTF8String value: Hello, Bytes consumed: 7
|
||||
```
|
||||
|
||||
Encoding ASN.1 data:
|
||||
|
||||
```csharp
|
||||
// Create an AsnWriter to encode data
|
||||
AsnWriter writer = new(AsnEncodingRules.DER);
|
||||
|
||||
// Create a scope for the sequence
|
||||
using (AsnWriter.Scope scope = writer.PushSequence())
|
||||
{
|
||||
// Write integers to the sequence
|
||||
writer.WriteInteger(1);
|
||||
writer.WriteInteger(2);
|
||||
writer.WriteInteger(3);
|
||||
}
|
||||
|
||||
// Get the encoded data
|
||||
byte[] encodedData = writer.Encode();
|
||||
|
||||
Console.WriteLine($"Encoded ASN.1 Data: {BitConverter.ToString(encodedData)}");
|
||||
|
||||
// Encoded ASN.1 Data: 30-09-02-01-01-02-01-02-02-01-03
|
||||
```
|
||||
|
||||
## Main Types
|
||||
|
||||
<!-- The main types provided in this library -->
|
||||
|
||||
The main types provided by this library are:
|
||||
|
||||
* `System.Formats.Asn1.AsnReader`
|
||||
* `System.Formats.Asn1.AsnWriter`
|
||||
* `System.Formats.Asn1.AsnDecoder`
|
||||
* `System.Formats.Asn1.AsnEncodingRules`
|
||||
|
||||
## Additional Documentation
|
||||
|
||||
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
|
||||
|
||||
* [API documentation](https://learn.microsoft.com/dotnet/api/system.formats.asn1)
|
||||
* [X.680 - Abstract Syntax Notation One (ASN.1): Specification of basic notation](https://www.itu.int/rec/T-REC-X.680)
|
||||
* [X.690 - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)](https://www.itu.int/rec/T-REC-X.690)
|
||||
|
||||
## Feedback & Contributing
|
||||
|
||||
<!-- How to provide feedback on this package and contribute to it -->
|
||||
|
||||
System.Formats.Asn1 is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
|
||||
BIN
packages/System.Formats.Asn1.9.0.4/System.Formats.Asn1.9.0.4.nupkg
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/System.Formats.Asn1.9.0.4.nupkg
vendored
Normal file
Binary file not shown.
1396
packages/System.Formats.Asn1.9.0.4/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
1396
packages/System.Formats.Asn1.9.0.4/THIRD-PARTY-NOTICES.TXT
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
packages/System.Formats.Asn1.9.0.4/buildTransitive/net461/System.Formats.Asn1.targets
vendored
Normal file
6
packages/System.Formats.Asn1.9.0.4/buildTransitive/net461/System.Formats.Asn1.targets
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project InitialTargets="NETStandardCompatError_System_Formats_Asn1_net462">
|
||||
<Target Name="NETStandardCompatError_System_Formats_Asn1_net462"
|
||||
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
|
||||
<Warning Text="System.Formats.Asn1 9.0.4 doesn't support $(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to net462 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
|
||||
</Target>
|
||||
</Project>
|
||||
0
packages/System.Formats.Asn1.9.0.4/buildTransitive/net462/_._
vendored
Normal file
0
packages/System.Formats.Asn1.9.0.4/buildTransitive/net462/_._
vendored
Normal file
0
packages/System.Formats.Asn1.9.0.4/buildTransitive/net8.0/_._
vendored
Normal file
0
packages/System.Formats.Asn1.9.0.4/buildTransitive/net8.0/_._
vendored
Normal file
6
packages/System.Formats.Asn1.9.0.4/buildTransitive/netcoreapp2.0/System.Formats.Asn1.targets
vendored
Normal file
6
packages/System.Formats.Asn1.9.0.4/buildTransitive/netcoreapp2.0/System.Formats.Asn1.targets
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project InitialTargets="NETStandardCompatError_System_Formats_Asn1_net8_0">
|
||||
<Target Name="NETStandardCompatError_System_Formats_Asn1_net8_0"
|
||||
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
|
||||
<Warning Text="System.Formats.Asn1 9.0.4 doesn't support $(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
|
||||
</Target>
|
||||
</Project>
|
||||
BIN
packages/System.Formats.Asn1.9.0.4/lib/net462/System.Formats.Asn1.dll
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/lib/net462/System.Formats.Asn1.dll
vendored
Normal file
Binary file not shown.
4466
packages/System.Formats.Asn1.9.0.4/lib/net462/System.Formats.Asn1.xml
vendored
Normal file
4466
packages/System.Formats.Asn1.9.0.4/lib/net462/System.Formats.Asn1.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/System.Formats.Asn1.9.0.4/lib/net8.0/System.Formats.Asn1.dll
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/lib/net8.0/System.Formats.Asn1.dll
vendored
Normal file
Binary file not shown.
4286
packages/System.Formats.Asn1.9.0.4/lib/net8.0/System.Formats.Asn1.xml
vendored
Normal file
4286
packages/System.Formats.Asn1.9.0.4/lib/net8.0/System.Formats.Asn1.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/System.Formats.Asn1.9.0.4/lib/net9.0/System.Formats.Asn1.dll
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/lib/net9.0/System.Formats.Asn1.dll
vendored
Normal file
Binary file not shown.
4286
packages/System.Formats.Asn1.9.0.4/lib/net9.0/System.Formats.Asn1.xml
vendored
Normal file
4286
packages/System.Formats.Asn1.9.0.4/lib/net9.0/System.Formats.Asn1.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/System.Formats.Asn1.9.0.4/lib/netstandard2.0/System.Formats.Asn1.dll
vendored
Normal file
BIN
packages/System.Formats.Asn1.9.0.4/lib/netstandard2.0/System.Formats.Asn1.dll
vendored
Normal file
Binary file not shown.
4466
packages/System.Formats.Asn1.9.0.4/lib/netstandard2.0/System.Formats.Asn1.xml
vendored
Normal file
4466
packages/System.Formats.Asn1.9.0.4/lib/netstandard2.0/System.Formats.Asn1.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
packages/System.Formats.Asn1.9.0.4/useSharedDesignerContext.txt
vendored
Normal file
0
packages/System.Formats.Asn1.9.0.4/useSharedDesignerContext.txt
vendored
Normal file
Reference in New Issue
Block a user