public static async Task <IList <LdapEntry> > SearchBySidAsync(this ILdapConnection connection, string @base, string sid, LdapSearchScope scope = LdapSearchScope.LDAP_SCOPE_SUBTREE) { var hex = HexEscaper.Escape(LdapSidConverter.ConvertToHex(sid)); return(await connection.SearchAsync(@base, $"(objectSID={hex})", scope : scope)); }
public void HexEscaper_Escape_Should_Return_Hex_Chars_With_Back_Slash_Char() { var actual = HexEscaper.Escape("01052ABC"); Assert.AreEqual(@"\01\05\2A\BC", actual); }