Active Directory objectsid to string

通过LDAP查找出来的结果的Properties中经常会包含byte[]类型的SId,并不是我们在AD中看到的s-x-x-形式的。通过以下函数将其转换。

 1  ///   <summary>
 2  ///  转换Byte Sid to string
 3  ///   </summary>
 4  ///   <param name="sidBinary"></param>
 5  ///   <returns></returns>
 6  public  static  string ConvertBinarySid2String( byte[] sidBinary)
 7 {
 8     SecurityIdentifier sid =  new SecurityIdentifier(sidBinary,  0);
 9      return sid.ToString();
10 }

转载于:https://www.cnblogs.com/netwenchao/archive/2012/05/25/2518214.html

猜你喜欢

转载自blog.csdn.net/weixin_34119545/article/details/93607878