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 LdapSidConverter_ParseFromBytes_Convert_SID_Bytes_To_String(byte[] sid, string expected)
        {
            var actual = LdapSidConverter.ParseFromBytes(sid);

            Assert.Equal(expected, actual);
        }
        public void LdapSidConverter_ConvertToHex_Return_String_In_Hex_Format()
        {
            var actual = LdapSidConverter.ConvertToHex("S-1-5-21-2127521184-1604012920-1887927527-72713");

            Assert.Equal("010500000000000515000000A065CF7E784B9B5FE77C8770091C0100", actual);
        }
Esempio n. 4
0
 public string GetObjectSid() => LdapSidConverter.ParseFromBytes(GetBytes("objectSid"));