Rfc2253 1.0.0
See the version list below for details.
dotnet add package Rfc2253 --version 1.0.0
NuGet\Install-Package Rfc2253 -Version 1.0.0
<PackageReference Include="Rfc2253" Version="1.0.0" />
<PackageVersion Include="Rfc2253" Version="1.0.0" />
<PackageReference Include="Rfc2253" />
paket add Rfc2253 --version 1.0.0
#r "nuget: Rfc2253, 1.0.0"
#addin nuget:?package=Rfc2253&version=1.0.0
#tool nuget:?package=Rfc2253&version=1.0.0
RFC 2253 Distinguished Name Parser
A .NET Core 2.0 package to parse LDAP (or X.509) Distinguished Names and optionally normalize them so that two (or more) Distinguished Names can be compared to one another for equivalency.
Closely follows RFC 2253 (https://www.ietf.org/rfc/rfc2253.txt) for parsing. Parses both LDAPv2 and LDAPv3, but normalizes output for LDAPv3.
Package is released under the MIT license.
You may review the source and contribute to the project at GitHub: https://github.com/Ski-Dive-Dev/RFC2253
Instructions for Use
- Supply a Distinguished Name to be parsed to the
DistinguishedName.Create(string distinguishedName)
method - Call the
Normalized()
method on the returned object to normalize the internal structures to be strictly compliant to RFC 2253 - Do the same two calls for another Distinguished Name
- To compare the two Distinguished Names for equivalency, compare the
DistinguishedName
objects'ToString()
results to one another
Currently, RDNs must be in the same order in both Distinguished Names being compared, and OIDs do not match against Attribute Names -- these features will be added in a future version.
Sample NUnit Test Cases
[TestCase(@"CN=Steve Kille,O=Isode Limited,C=GB",
ExpectedResult = @"cn=Steve Kille,o=Isode Limited,c=GB")]
[TestCase(@"OU=Sales+CN=J. Smith,O=Widget Inc.,C=US",
ExpectedResult = @"ou=Sales+cn=J. Smith,o=Widget Inc.,c=US")]
[TestCase(@"CN=L. Eagle,O=Sue\, Grabbit and Runn,C=GB",
ExpectedResult = @"cn=L. Eagle,o=Sue\, Grabbit and Runn,c=GB")]
[TestCase(@"CN =Before\0DAfter,O= Test,C = GB", ExpectedResult = @"cn=Before\0DAfter,o=Test,c=GB")]
[TestCase(@"1.3.6.1.4.1.1466.0=#04024869,O=Test,C=GB",
ExpectedResult = @"1.3.6.1.4.1.1466.0=#04024869,o=Test,c=GB")]
[TestCase(@"SN=Lu\C4\8Di\C4\87", ExpectedResult = @"sn=Lu\C4\8Di\C4\87")]
[TestCase(@"OID.1.3.6.1.4.1.1466.0=Bytes \+ Bytes, O=OID Prefix,C=GB",
ExpectedResult = @"1.3.6.1.4.1.1466.0=Bytes \+ Bytes,o=OID Prefix,c=GB")]
[TestCase(@"", ExpectedResult = @"")]
[TestCase(@"CN=""Quoted Last, Quoted First"", O=Space After Comma ; C = Semi's too!",
ExpectedResult = @"cn=Quoted Last\, Quoted First,o=Space After Comma,c=Semi's too!")]
[TestCase(@"CN=", ExpectedResult = @"cn=")]
[TestCase(@"CN=,sn=Smith", ExpectedResult = @"cn=,sn=Smith")]
[TestCase(@"Good\20Dog", ExpectedResult = @"Good Dog")]
[TestCase(@"Smith\2cJohn", ExpectedResult = @"Smith\,John")]
[TestCase(@"Smith\2CJohn", ExpectedResult = @"Smith\,John")]
[TestCase(@"My\FFChar", ExpectedResult = @"My\FFChar")]
[TestCase(@"My\0DChar", ExpectedResult = @"My\0DChar")]
[TestCase(@"My\0dChar", ExpectedResult = @"My\0DChar")]
[TestCase(@"This\+That", ExpectedResult = @"This\+That")]
[TestCase(@"Literal Back\\Slash", ExpectedResult = @"Literal Back\\Slash")]
[TestCase(@"Not\&Valid", ExpectedResult = @"Not\&Valid")]
[TestCase(@"", ExpectedResult = @"")]
[TestCase("\"All good boys deserve fudge.\"", ExpectedResult = "All good boys deserve fudge.")]
[TestCase("\"All good boys + girls deserve fudge.\"", ExpectedResult = "All good boys \\+ girls deserve fudge.")]
[TestCase("\"Boys, girls + adults deserve fudge.\"", ExpectedResult = "Boys\\, girls \\+ adults deserve fudge.")]
[TestCase("\"Don't expect to fix \\3cthis\\3e; but this.\"",
ExpectedResult = "Don't expect to fix \\3cthis\\3e\\; but this.")]
[TestCase("\" Leading Spaces\"", ExpectedResult = "\\20 Leading Spaces")]
[TestCase("\"Trailing Spaces \"", ExpectedResult = "Trailing Spaces \\20")]
[TestCase("\" Leading and Trailing Spaces \"", ExpectedResult = "\\20 Leading and Trailing Spaces \\20")]
[TestCase("\"Only opening quote", ExpectedResult = "\"Only opening quote")]
[TestCase("Only closing quote\"", ExpectedResult = "Only closing quote\"")]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. 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 Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Rfc2253:
Package | Downloads |
---|---|
AspNetCore.Authentication.SK.SmartID
SK Smart-ID external authentication for ASP.NET Core applications. |
|
AspNetCore.Authentication.SK.IdCard
SK ID-card external authentication for ASP.NET Core applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Released under the MIT License.