Struct security_framework::item::ItemSearchOptions

source ·
pub struct ItemSearchOptions { /* private fields */ }
Expand description

A builder type to search for items in keychains.

Implementations§

source§

impl ItemSearchOptions

source

pub fn new() -> Self

Creates a new builder with default options.

source

pub fn class(&mut self, class: ItemClass) -> &mut Self

Search only for items of the specified class.

source

pub fn case_insensitive(&mut self, case_insensitive: Option<bool>) -> &mut Self

Whether search for an item should be case insensitive or not.

source

pub fn key_class(&mut self, key_class: KeyClass) -> &mut Self

Search only for keys of the specified class. Also sets self.class to ItemClass::key().

source

pub fn load_refs(&mut self, load_refs: bool) -> &mut Self

Load Security Framework objects (SecCertificate, SecKey, etc) for the results.

source

pub fn load_attributes(&mut self, load_attributes: bool) -> &mut Self

Load Security Framework object attributes for the results.

source

pub fn load_data(&mut self, load_data: bool) -> &mut Self

Load Security Framework objects data for the results.

source

pub fn limit<T: Into<Limit>>(&mut self, limit: T) -> &mut Self

Limit the number of search results.

If this is not called, the default limit is 1.

source

pub fn label(&mut self, label: &str) -> &mut Self

Search for an item with the given label.

source

pub fn trusted_only(&mut self, trusted_only: Option<bool>) -> &mut Self

Whether untrusted certificates should be returned.

source

pub fn service(&mut self, service: &str) -> &mut Self

Search for an item with the given service.

source

pub fn subject(&mut self, subject: &str) -> &mut Self

Search for an item with exactly the given subject.

source

pub fn account(&mut self, account: &str) -> &mut Self

Search for an item with the given account.

source

pub fn access_group(&mut self, access_group: &str) -> &mut Self

Search for an item with a specific access group.

source

pub fn access_group_token(&mut self) -> &mut Self

Sets kSecAttrAccessGroup to kSecAttrAccessGroupToken

source

pub fn pub_key_hash(&mut self, pub_key_hash: &[u8]) -> &mut Self

Search for a certificate with the given public key hash.

This is only compatible with ItemClass::certificate, to search for a key by public key hash use ItemSearchOptions::application_label instead.

source

pub fn application_label(&mut self, app_label: &[u8]) -> &mut Self

Search for a key with the given public key hash.

This is only compatible with ItemClass::key, to search for a certificate by the public key hash use ItemSearchOptions::pub_key_hash instead.

source

pub fn search(&self) -> Result<Vec<SearchResult>>

Search for objects.

Trait Implementations§

source§

impl Default for ItemSearchOptions

source§

fn default() -> ItemSearchOptions

Returns the “default value” for a type. Read more
source§

impl ItemSearchOptionsExt for ItemSearchOptions

source§

fn keychains(&mut self, keychains: &[SecKeychain]) -> &mut Self

Search within the specified keychains. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.