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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecurityIdentifier
impl Debug for SecurityIdentifier
Source§impl Display for SecurityIdentifier
impl Display for SecurityIdentifier
Source§impl FromStr for SecurityIdentifier
impl FromStr for SecurityIdentifier
Source§impl Hash for SecurityIdentifier
impl Hash for SecurityIdentifier
Source§impl Ord for SecurityIdentifier
impl Ord for SecurityIdentifier
Source§fn cmp(&self, other: &SecurityIdentifier) -> Ordering
fn cmp(&self, other: &SecurityIdentifier) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SecurityIdentifier
impl PartialEq for SecurityIdentifier
Source§fn eq(&self, other: &SecurityIdentifier) -> bool
fn eq(&self, other: &SecurityIdentifier) -> bool
self and other values to be equal, and is used by ==.