pub struct TokenSelector {
pub backend: Option<String>,
pub slot: Option<u64>,
pub token_label: Option<String>,
pub token_serial_number: Option<String>,
}Expand description
Selects tokens with the specified identifier.
Fields§
§backend: Option<String>Selects the named backend.
Backends are usually specified by their full path, e.g.,
/usr/lib/x86_64-linux-gnu/libykcs11.so.2. This matches on
the full path, on the filename, the filename with each
trailing component stripped, i.e., libykcs11.so.2,
libykcs11.so, and libykcs11, and the filename with any
initial lib prefix and all trailing components striped,
i.e., ykcs11.
slot: Option<u64>Selects the token in the specified slot.
token_label: Option<String>Selects tokens with the specified label.
The user normally sets the token’s label when it is initialized.
The value of the restriction is compared to both the token’s raw label and the label encoded in hex. This allows matching labels with non-printable characters.
token_serial_number: Option<String>Selects tokens with the specified serial number.
The serial number is set when the token is initialized.
The value of the restriction is compared to both the token’s raw serial number and the serial number encoded in hex. This allows matching serial numbers with non-printable characters.
Implementations§
Source§impl TokenSelector
impl TokenSelector
Sourcepub fn unconstrained() -> Self
pub fn unconstrained() -> Self
Returns an unconstrained TokenSelector.
This matches all tokens.
Sourcepub fn has_backend_restrictions(&self) -> bool
pub fn has_backend_restrictions(&self) -> bool
Returns true if the selector has any restrictions on the
backend.
A selector without restrictions matches everything.
Sourcepub fn has_token_restrictions(&self) -> bool
pub fn has_token_restrictions(&self) -> bool
Returns true if the selector has any restrictions on the
token.
A selector without restrictions matches everything.
Sourcepub fn has_restrictions(&self) -> bool
pub fn has_restrictions(&self) -> bool
Returns true if the selector has any restrictions.
A selector without restrictions matches everything.
Sourcepub fn backend_matches(&self, backend: &Backend) -> bool
pub fn backend_matches(&self, backend: &Backend) -> bool
Returns true if the selector matches the backend.
If the selector does not restrict the backend, then this
returns true.
Sourcepub fn slot_matches(&self, slot: u64) -> bool
pub fn slot_matches(&self, slot: u64) -> bool
Returns true if the selector matches the specified slot.
If the selector does not restrict the slot, then this returns
true.
Sourcepub fn token_label(&self) -> Option<&str>
pub fn token_label(&self) -> Option<&str>
Returns the token label restriction, if any.
Sourcepub fn token_label_matches(&self, label: &str) -> bool
pub fn token_label_matches(&self, label: &str) -> bool
Returns true if the selector matches the specified token’s
label.
If the selector does not restrict the token’s label, then this
returns true.
The value of the restriction is compared to both the object’s raw label and the label encoded in hex. This allows matching labels with non-printable characters.
Sourcepub fn token_serial_number(&self) -> Option<&str>
pub fn token_serial_number(&self) -> Option<&str>
Returns the token’s serial number restriction, if any.
Sourcepub fn token_serial_number_matches(&self, serial_number: &str) -> bool
pub fn token_serial_number_matches(&self, serial_number: &str) -> bool
Returns true if the selector matches the specified token’s
serial number.
If the selector does not restrict the token’s serial number,
then this returns true.
The value of the restriction is compared to both the token’s raw serial number and the serial number encoded in hex. This allows matching on serial numbers with non-printable characters.
Trait Implementations§
Source§impl Clone for TokenSelector
impl Clone for TokenSelector
Source§fn clone(&self) -> TokenSelector
fn clone(&self) -> TokenSelector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more