Skip to content

Instantly share code, notes, and snippets.

@dsibiski
dsibiski / DistinguishedName.cs
Created October 21, 2020 02:56 — forked from davetransom/DistinguishedName.cs
Implementation of LDAP Distinguished Name parser, based on http://stackoverflow.com/a/25335936/137854. Also trims leading whitespace from attribute names and handles quoted values e.g. the `O="VeriSign, Inc."` in `CN=VeriSign Class 3 Secure Server CA - G3, OU=Terms of use at https://www.verisign.com/rpa (c)10, OU=VeriSign Trust Network, O="VeriS…
public class DistinguishedName
{
/// <summary>
/// Represents a name/value pair within a distinguished name, including the index of the part.
/// </summary>
public struct Part
{
public Part(string name, string value, int index = -1)
: this()
{
du -h . | sort -nr | more