In Windows Operating System, user SIDs are represented with a string such as :
S-5-1-76-1812374880-3438888550-261701130-6117
Is there any way that I can identify that such a string is a valid User SID?
Thanks.
The SID (Security IDentifier) is a unique ID number that a computer or domain controller uses to identify you. It is a string of alphanumeric characters assigned to each user on a Windows computer, or to each user, group, and computer on a domain-controlled network such as Indiana University's Active Directory.
SID (Security IDentifier) is a unique identifier that is assigned to users, groups, computers, or other security objects when they are created in Windows or Active Directory domain.
You can use the command line (cmd) to convert SID to username using the wmic command. Using the wmic command to get user account, specify the user SID in the where clause to get a user from SID.
If you need to check SID is SID, use SecurityIdentifier constructor inside try\catch
.
This will not validate that this sid belongs to anyone\anything in the whole world.
SIDs are
S
-1-
(this is SID version, and there is only one)
281474976710656
(15 characters)-
separated SID_IDENTIFIER_SUBAUTHORITY which are not more than 4 bytes wide (10 characters max)-
separated which is not more than 4 bytes wide (10 characters max)More detailed refer to MS-AZOD, chapter 1.1.1.2
I found this slight variation helpful which allows for some well known security identifiers. For example, the well known sid Everyone S-1-1-0
^S-\d-(\d+-){1,14}\d+$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With