Пример #1
0
 public void testConvertSid() {
   String sidString = "S-1-1-0"; // Everyone
   byte[] sidBytes = Advapi32Util.convertStringSidToSid(sidString);
   assertTrue(sidBytes.length > 0);
   String convertedSidString = Advapi32Util.convertSidToStringSid(new PSID(sidBytes));
   assertEquals(convertedSidString, sidString);
 }
Пример #2
0
 public void testIsWellKnownSid() {
   String everyoneString = "S-1-1-0";
   assertTrue(Advapi32Util.isWellKnownSid(everyoneString, WELL_KNOWN_SID_TYPE.WinWorldSid));
   assertFalse(
       Advapi32Util.isWellKnownSid(
           everyoneString, WELL_KNOWN_SID_TYPE.WinAccountAdministratorSid));
   byte[] everyoneBytes = Advapi32Util.convertStringSidToSid(everyoneString);
   assertTrue(Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinWorldSid));
   assertFalse(
       Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinAccountAdministratorSid));
 }