Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Principal.​SecurityIdentifier
Assembly: System.Security.Principal.Windows
Inheritance: object → IdentityReference → SecurityIdentifier
Implemented Interfaces
Represents a security identifier (SID) and provides marshaling and comparison operations for SIDs.
Fields and Constants
public static readonly
int
MaxBinaryLength
Returns the maximum size, in bytes, of the binary representation of the security identifier.
public static readonly
int
MinBinaryLength
Returns the minimum size, in bytes, of the binary representation of the security identifier.
Properties
public
SecurityIdentifier
AccountDomainSid
Returns the account domain security identifier (SID) portion from the SID represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object if the SID represents a Windows account SID. If the SID does not represent a Windows account SID, this property returns <see langword="null" /> .
public
int
BinaryLength
Returns the length, in bytes, of the security identifier (SID) represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public
string
Value
Returns an uppercase Security Descriptor Definition Language (SDDL) string for the security identifier (SID) represented by this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
Methods
public
int
CompareTo​(SecurityIdentifier sid)
Compares the current <see cref="T:System.Security.Principal.SecurityIdentifier" /> object with the specified <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
Returns A signed number indicating the relative values of this instance and <paramref name="sid" /> .
<list type="table">
<listheader>
<term> Return Value</term>
<description> Description</description>
</listheader>
<item>
<term> Less than zero</term>
<description> This instance is less than <paramref name="sid" />.</description>
</item>
<item>
<term> Zero</term>
<description> This instance is equal to <paramref name="sid" />.</description>
</item>
<item>
<term> Greater than zero</term>
<description> This instance is greater than <paramref name="sid" />.</description>
</item>
</list>
sid
The object to compare with the current object.
public
bool
Equals​(object o)
Returns a value that indicates whether this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is equal to a specified object.
Returns <see langword="true" /> if <paramref name="o" /> is an object with the same underlying type and value as this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object; otherwise, <see langword="false" /> .
o
An object to compare with this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object, or <see langword="null" /> .
public
bool
Equals​(SecurityIdentifier sid)
Indicates whether the specified <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is equal to the current <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
Returns <see langword="true" /> if the value of <paramref name="sid" /> is equal to the value of the current <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
sid
The object to compare with the current object.
public
void
GetBinaryForm​(byte[] binaryForm,
int offset)
Copies the binary representation of the specified security identifier (SID) represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> class to a byte array.
binaryForm
The byte array to receive the copied SID.
offset
The byte offset to use as the starting index in <paramref name="binaryForm" /> .
public
int
GetHashCode​()
Serves as a hash function for the current <see cref="T:System.Security.Principal.SecurityIdentifier" /> object. The <see cref="M:System.Security.Principal.SecurityIdentifier.GetHashCode" /> method is suitable for hashing algorithms and data structures like a hash table.
Returns A hash value for the current <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public
bool
IsAccountSid​()
Returns a value that indicates whether the security identifier (SID) represented by this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is a valid Windows account SID.
Returns <see langword="true" /> if the SID represented by this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is a valid Windows account SID; otherwise, <see langword="false" /> .
public
bool
IsEqualDomainSid​(SecurityIdentifier sid)
Returns a value that indicates whether the security identifier (SID) represented by this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is from the same domain as the specified SID.
Returns <see langword="true" /> if the SID represented by this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object is in the same domain as the <paramref name="sid" /> SID; otherwise, <see langword="false" /> .
sid
The SID to compare with this <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public
bool
IsValidTargetType​(Type targetType)
Returns a value that indicates whether the specified type is a valid translation type for the <see cref="T:System.Security.Principal.SecurityIdentifier" /> class.
Returns <see langword="true" /> if <paramref name="targetType" /> is a valid translation type for the <see cref="T:System.Security.Principal.SecurityIdentifier" /> class; otherwise, <see langword="false" /> .
targetType
The type being queried for validity to serve as a conversion from <see cref="T:System.Security.Principal.SecurityIdentifier" /> . The following target types are valid:
- <see cref="T:System.Security.Principal.NTAccount" />
- <see cref="T:System.Security.Principal.SecurityIdentifier" /> .
public
bool
IsWellKnown​(WellKnownSidType type)
Returns a value that indicates whether the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object matches the specified well known security identifier (SID) type.
Returns <see langword="true" /> if <paramref name="type" /> is the SID type for the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object; otherwise, <see langword="false" /> .
type
A value to compare with the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public
string
ToString​()
Returns the security identifier (SID), in Security Descriptor Definition Language (SDDL) format, for the account represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object. An example of the SDDL format is S-1-5-9.
Returns The SID, in SDDL format, for the account represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object.
public
IdentityReference
Translate​(Type targetType)
Translates the account name represented by the <see cref="T:System.Security.Principal.SecurityIdentifier" /> object into another <see cref="T:System.Security.Principal.IdentityReference" /> -derived type.
Returns The converted identity.
targetType
The target type for the conversion from <see cref="T:System.Security.Principal.SecurityIdentifier" /> . The target type must be a type that is considered valid by the <see cref="M:System.Security.Principal.SecurityIdentifier.IsValidTargetType(System.Type)" /> method.
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object