Sid

The Sid class represents a security identifier (SID).

Inheritance: The Sid class implements the ISerializable and IComparable<Sid> interfaces.

Namespace: Softerra.Adaxes.Adsi

Constructors

  • Constructor

  • Description

  • Sid(IntPtr)

  • Constructs a new instance of the Sid class using an integer that represents the binary form of a security identifier (SID).

  • Sid(string)

  • Constructs a new instance of the Sid class using the specified security identifier (SID) in the SDDL format (e.g. S-1-5-1-123-456-789).

  • Sid(Byte[], int)

  • Constructs a new instance of the Sid class using the specified binary representation of a security identifier (SID).

  • Sid(WellKnownSidType, Sid)

  • Constructs a new instance of the Sid class using the specified well-known security identifier (SID) type and domain SID.

  • Sid(SecurityIdentifier)

  • Constructs a new instance of the Sid class by copying data from the specified instance of the SecurityIdentifier class.

Methods

  • Method

  • Description

  • CompareTo()

  • Compares the SID with another SID.

  • GetObjectData()

  • Populates an instance of the SerializationInfo class with data required to serialize the instance of the Sid class.

  • GetBinaryForm()

  • Copies the binary representation of the security identifier to a Byte[] array.

  • IsAccountSid()

  • Checks whether the security identifier is a valid Windows account SID.

  • IsBuiltin()

  • Checks whether the security identifier is a built-in SID.

  • IsEqualDomainSid()

  • Checks whether the security identifier is from the same domain as the specified SID.

  • IsValidTargetType()

  • Checks whether the specified type is a valid translation type for the Sid class.

  • IsWellKnown()

  • Checks whether the security identifier matches the specified well-known security identifier type.

  • Translate()

  • Translates the account name represented by the SID into another IdentityReference-derived type.

Properties

  • Property

  • Description

  • MaxBinaryLength

  • Gets the maximum size, in bytes, of the binary representation of the security identifier.

  • MinBinaryLength

  • Gets the minimum size, in bytes, of the binary representation of the security identifier.

  • AccountDomainSid

  • Gets the account domain SID portion from the SID represented by the instance of the Sid class.

  • BinaryLength

  • Gets the length, in bytes, of the security identifier represented by the instance of the Sid class.

  • Value

  • Gets an uppercase SDDL-formatted representation of the security identifier represented by the instance of the Sid class.

  • SecurityIdentifier

  • Gets the instance of the SecurityIdentifier class that is used by this class.

Details

Sid(IntPtr)

Constructs a new instance of the Sid class using an integer that represents the binary form of a security identifier (SID).

Sid(IntPtr binaryForm)

Sid(string)

Constructs a new instance of the Sid class using the specified security identifier (SID) in the SDDL format (e.g. S-1-5-1-123-456-789).

Sid(string sddlForm)

Sid(Byte[], int)

Constructs a new instance of the Sid class using the specified binary representation of a security identifier (SID).

Sid(Byte[] binaryForm, int offset)

Parameters

  • binaryForm - An array of bytes representing the binary representation of the SID.
  • offset - Specifies the byte offset to use as the starting index when parsing the SID.

Sid(WellKnownSidType, Sid)

Constructs a new instance of the Sid class using the specified well-known security identifier (SID) type and domain SID.

Sid(WellKnownSidType sidType, Sid domainSid)

Parameters

  • sidType - Specifies the well-known SID type to construct the class from. This value must not be set to WinLogonIdsSid. For more information and a list of values, see WellKnownSidType.
  • domainSid - Specifies the domain SID. This value is required for the following sidType values:
    • WinAccountAdministratorSid
    • WinAccountGuestSid
    • WinAccountKrbtgtSid
    • WinAccountDomainAdminsSid
    • WinAccountDomainUsersSid
    • WinAccountDomainGuestsSid
    • WinAccountComputersSid
    • WinAccountControllersSid
    • WinAccountCertAdminsSid
    • WinAccountSchemaAdminsSid
    • WinAccountEnterpriseAdminsSid
    • WinAccountPolicyAdminsSid
    • WinAccountRasAndIasServersSid

Sid(SecurityIdentifier)

Constructs a new instance of the Sid class by copying data from the specified instance of the SecurityIdentifier class.

Sid(SecurityIdentifier sid)

CompareTo()

Compares the SID with another SID.

int CompareTo(Sid otherSid)

Return value

The method returns an int that indicates the relative order of the objects being compared. The return value has the following meanings:

  • If the return value is less than zero, this SID is less than the SID specified in the otherSid parameter.
  • If the return value is 0, this SID is equal to the SID specified in the otherSid parameter.
  • If the return value is greater than zero, this SID is greater than the SID specified in the otherSid parameter

GetObjectData()

Populates an instance of the SerializationInfo class with data required to serialize the instance of the Sid class.

void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

  • info - Specifies an instance of the SerializationInfo class to populate with data.
  • context - Specifies the destination for this serialization.

GetBinaryForm()

Copies the binary representation of the security identifier to a Byte[] array.

void GetBinaryForm(Byte[] binaryForm, int offset)

Parameters

  • binaryForm - Specifies the Byte[] array to receive the SID.
  • offset - Specifies the byte offset to use as the starting index in the array.

IsAccountSid()

Checks whether the security identifier is a valid Windows account SID. If the SID does not represent a Windows account SID, the method throws the ArgumentNullException exception.

bool IsAccountSid()

IsBuiltin()

Checks whether the security identifier is a built-in SID.

bool IsBuiltin()

IsEqualDomainSid()

Checks whether the security identifier is from the same domain as the specified SID.

bool IsEqualDomainSid(SecurityIdentifier sid)

IsValidTargetType()

Checks whether the specified type is a valid translation type for the Sid class. The following target types are valid: NTAccount and SecurityIdentifier.

bool IsValidTargetType(Type targetType)

IsWellKnown()

Checks whether the security identifier matches the specified well-known security identifier type.

bool IsWellKnown(WellKnownSidType type)

Parameters

The sidType parameter specifies the well-known SID type to compare the SID to. For more information and a list of values, see WellKnownSidType.


Translate()

Translates the account name represented by the SID into another IdentityReference-derived type.

IdentityReference Translate(Type targetType)

Parameters

The targetType parameter specifies the target type for the conversion. The target type must be a type that is considered valid by the IsValidTargetType method.


MaxBinaryLength

Gets the maximum size, in bytes, of the binary representation of the security identifier.

  • Type:
  • int
  • Access:
  • Read-only (static)

MinBinaryLength

Gets the minimum size, in bytes, of the binary representation of the security identifier.

  • Type:
  • int
  • Access:
  • Read-only (static)

AccountDomainSid

Gets the account domain SID portion from the SID represented by the instance of the Sid class.

  • Type:
  • int
  • Access:
  • Read-only

BinaryLength

Gets the length, in bytes, of the security identifier represented by the instance of the Sid class.

  • Type:
  • int
  • Access:
  • Read-only

Value

Gets an uppercase SDDL-formatted representation of the security identifier represented by the instance of the Sid class.

  • Type:
  • int
  • Access:
  • Read-only

SecurityIdentifier

Gets the instance of the SecurityIdentifier class that is used by this class.

  • Type:
  • int
  • Access:
  • Read-only

Requirements

Minimum required version: 2009.1

See also