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],
) -> SecurityIdentifier
pub fn new( identifier_authority: impl Into<IdentifierAuthority>, sub_authority: &[u32], ) -> SecurityIdentifier
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],
) -> SecurityIdentifier
pub const fn new_const<const N: usize>( identifier_authority: u64, sub_authority: [u32; N], ) -> SecurityIdentifier
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<SecurityIdentifier, SecurityIdentifierError>
pub fn from_bytes( input: &[u8], ) -> Result<SecurityIdentifier, 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
impl Eq for SecurityIdentifier
Source§impl FromStr for SecurityIdentifier
impl FromStr for SecurityIdentifier
Source§type Err = SecurityIdentifierError
type Err = SecurityIdentifierError
Source§fn from_str(
input: &str,
) -> Result<SecurityIdentifier, <SecurityIdentifier as FromStr>::Err>
fn from_str( input: &str, ) -> Result<SecurityIdentifier, <SecurityIdentifier as FromStr>::Err>
s to return a value of this type. Read more