pub struct SecurityIdentifier { /* private fields */ }Expand description
Core type representing Windows security identifiers (“SID“s). Type represents version one SIDs, which consist of a single 48 bit identifier authority, followed by up to 256 sub-authorities.
Implementations§
Source§impl SecurityIdentifier
impl SecurityIdentifier
Sourcepub fn new(
identifier_authority: impl Into<IdentifierAuthority>,
sub_authority: &[u32],
) -> Self
pub fn new( identifier_authority: impl Into<IdentifierAuthority>, sub_authority: &[u32], ) -> Self
Constructs a new SID manually.
Version number is hard-coded to one, as no other version presently exists.
§Panics
Will panic if an attempt is made to construct a SID with more than 256 sub-authorities.
Sourcepub const fn new_const<const N: usize>(
identifier_authority: u64,
sub_authority: [u32; N],
) -> Self
pub const fn new_const<const N: usize>( identifier_authority: u64, sub_authority: [u32; N], ) -> Self
Constructs a new SID manually (const version)
Version number is hard-coded to one, as no other version presently exists. See the sid macro for a friendlier adapter to this function.
§Panics
Will panic if an attempt is made to construct a SID with more than 6 sub-authorities.
Sourcepub fn from_bytes(input: &[u8]) -> Result<Self, SecurityIdentifierError>
pub fn from_bytes(input: &[u8]) -> Result<Self, SecurityIdentifierError>
Reads a SID from a slice of bytes.
SID must be in binary format - for text SIDs, first parse into a string.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Writes a SID in binary format and returns a Vec containing the binary representation.
Sourcepub fn to_ldap_predicate(&self) -> String
pub fn to_ldap_predicate(&self) -> String
Constructs an LDAP predicate that represents the objectSID attribute being equal to this SID.
Sourcepub fn get_resource_identifier(&self) -> Option<&u32>
pub fn get_resource_identifier(&self) -> Option<&u32>
Retrieves the last sub-authority, if there are any. This is commonly referred to as the “resource identifier” or RID.
Retrieves the mandatory identifier authority
Retrieves sub-authorities
Trait Implementations§
Source§impl Clone for SecurityIdentifier
impl Clone for SecurityIdentifier
Source§fn clone(&self) -> SecurityIdentifier
fn clone(&self) -> SecurityIdentifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more