SecKeychain

Struct SecKeychain 

Source
pub struct SecKeychain { /* private fields */ }
Available on crate feature SecBase only.
Expand description

Contains information about a keychain.

See also Apple’s documentation

Implementations§

Source§

impl SecKeychain

Source

pub unsafe fn version(return_vers: NonNull<u32>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Determines the version of the Keychain Manager installed on the user�s system.

Parameter returnVers: On return, a pointer to the version number of the Keychain Manager installed on the current system.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

return_vers must be a valid pointer.

Source

pub unsafe fn open( path_name: NonNull<c_char>, keychain: NonNull<*mut SecKeychain>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Create a SecKeychainRef for a keychain at pathName. This keychain might not currently exist, use SecKeychainGetStatus if you want to confirm the existence of this keychain.

Parameter pathName: The POSIX path to a keychain.

Parameter keychain: On return, a pointer to the keychain reference. The memory that keychain occupies must be released by calling CFRelease when finished with it.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if the keychain parameter is invalid (NULL).

§Safety
  • path_name must be a valid pointer.
  • keychain must be a valid pointer.
Source

pub unsafe fn create( path_name: NonNull<c_char>, password_length: u32, password: *const c_void, prompt_user: bool, initial_access: Option<&SecAccess>, keychain: NonNull<*mut SecKeychain>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Creates a new keychain.

Parameter pathName: The POSIX path to a keychain file.

Parameter passwordLength: An unsigned 32-bit integer representing the length of the password buffer.

Parameter password: A pointer to the buffer containing the password. The password must be in canonical UTF8 encoding.

Parameter promptUser: A boolean representing whether to display a password dialog to the user.

Parameter initialAccess: An access reference.

Parameter keychain: On return, a pointer to a keychain reference. The memory that keychain occupies must be released by calling CFRelease when finished with it.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if the keychain parameter is invalid (NULL).

§Safety
  • path_name must be a valid pointer.
  • password must be a valid pointer or null.
  • keychain must be a valid pointer.
Source

pub unsafe fn delete(keychain_or_array: Option<&SecKeychain>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Removes one or more keychains from the current keychain searchlist, and deletes the keychain storage (if the keychains are file-based).

Parameter keychainOrArray: A single keychain reference or a reference to an array of keychains to delete. IMPORTANT: SecKeychainDelete does not dispose the memory occupied by keychain references; use the CFRelease function when you are completely finished with a keychain.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecInvalidKeychain (-25295) may be returned if the keychain parameter is invalid (NULL).

Source

pub unsafe fn set_settings( keychain: Option<&SecKeychain>, new_settings: NonNull<SecKeychainSettings>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Changes the settings of a keychain.

Parameter keychain: A reference to a keychain.

Parameter newSettings: A pointer to the new keychain settings.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

new_settings must be a valid pointer.

Source

pub unsafe fn copy_settings( keychain: Option<&SecKeychain>, out_settings: NonNull<SecKeychainSettings>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Copy the keychain settings.

Parameter keychain: A reference to the keychain from which to copy its settings.

Parameter outSettings: A pointer to a keychain settings structure. Since this structure is versioned, you must preallocate it and fill in the version of the structure.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

out_settings must be a valid pointer.

Source

pub unsafe fn unlock( keychain: Option<&SecKeychain>, password_length: u32, password: *const c_void, use_password: bool, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Unlocks the specified keychain.

Parameter keychain: A reference to the keychain to unlock. Pass NULL to specify the default keychain. If you pass NULL and the default keychain is currently locked, the keychain will appear as the default choice. If you pass a locked keychain, SecKeychainUnlock will use the password provided to unlock it. If the default keychain is currently unlocked, SecKeychainUnlock returns errSecSuccess.

Parameter passwordLength: An unsigned 32-bit integer representing the length of the password buffer.

Parameter password: A buffer containing the password for the keychain. Pass NULL if the user password is unknown. In this case, SecKeychainUnlock displays the Unlock Keychain dialog box, and the authentication user interface associated with the keychain about to be unlocked.

Parameter usePassword: A boolean indicating whether the password parameter is used. You should pass TRUE if it is used or FALSE if it is ignored.

Returns: A result code. See “Security Error Codes” (SecBase.h).

In most cases, your application does not need to call the SecKeychainUnlock function directly, since most Keychain Manager functions that require an unlocked keychain call SecKeychainUnlock automatically. If your application needs to verify that a keychain is unlocked, call the function SecKeychainGetStatus.

§Safety

password must be a valid pointer or null.

Source

pub unsafe fn lock(keychain: Option<&SecKeychain>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Locks the specified keychain.

Parameter keychain: A reference to the keychain to lock.

Returns: A result code. See “Security Error Codes” (SecBase.h).

Source

pub unsafe fn lock_all() -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Locks all keychains belonging to the current user.

Returns: A result code. See “Security Error Codes” (SecBase.h).

Source

pub unsafe fn copy_default(keychain: NonNull<*mut SecKeychain>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Retrieves a reference to the default keychain.

Parameter keychain: On return, a pointer to the default keychain reference.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

keychain must be a valid pointer.

Source

pub unsafe fn set_default(keychain: Option<&SecKeychain>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Sets the default keychain.

Parameter keychain: A reference to the keychain to set as default.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if the keychain parameter is invalid (NULL).

Source

pub unsafe fn copy_search_list(search_list: NonNull<*const CFArray>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Retrieves a keychain search list.

Parameter searchList: The returned list of keychains to search. When finished with the array, you must call CFRelease() to release the memory.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if the keychain list is not specified (NULL).

§Safety

search_list must be a valid pointer.

Source

pub unsafe fn set_search_list(search_list: &CFArray) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Specifies the list of keychains to use in a keychain search list.

Parameter searchList: The list of keychains to use in a search list when the SecKeychainCopySearchList function is called. An empty array clears the search list.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if the keychain list is not specified (NULL).

§Safety

search_list generic must be of the correct type.

Source§

impl SecKeychain

Source

pub unsafe fn copy_domain_default( domain: SecPreferencesDomain, keychain: NonNull<*mut SecKeychain>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
§Safety

keychain must be a valid pointer.

Source

pub unsafe fn set_domain_default( domain: SecPreferencesDomain, keychain: Option<&SecKeychain>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
Source

pub unsafe fn copy_domain_search_list( domain: SecPreferencesDomain, search_list: NonNull<*const CFArray>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
§Safety

search_list must be a valid pointer.

Source

pub unsafe fn set_domain_search_list( domain: SecPreferencesDomain, search_list: &CFArray, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
§Safety

search_list generic must be of the correct type.

Source

pub unsafe fn set_preference_domain(domain: SecPreferencesDomain) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
Source

pub unsafe fn preference_domain(domain: NonNull<SecPreferencesDomain>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.
§Safety

domain must be a valid pointer.

Source

pub unsafe fn status( keychain: Option<&SecKeychain>, keychain_status: NonNull<SecKeychainStatus>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Retrieves status information for the specified keychain.

Parameter keychain: A keychain reference. Pass NULL to specify the default keychain.

Parameter keychainStatus: On return, a pointer to the status of the specified keychain. See KeychainStatus for valid status constants.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

keychain_status must be a valid pointer.

Source

pub unsafe fn path( keychain: Option<&SecKeychain>, io_path_length: NonNull<u32>, path_name: NonNull<c_char>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Get the path of the specified keychain.

Parameter keychain: A reference to a keychain.

Parameter ioPathLength: On input, a pointer to the size of the buffer pointed to by pathName. On return, the size of the buffer without the zero termination.

Parameter pathName: On return, the POSIX path to the keychain.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety
  • io_path_length must be a valid pointer.
  • path_name must be a valid pointer.
Source

pub unsafe fn attribute_info_for_item_id( keychain: Option<&SecKeychain>, item_id: u32, info: NonNull<*mut SecKeychainAttributeInfo>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Obtains tags for all possible attributes for a given item class.

Parameter keychain: A keychain reference.

Parameter itemID: The relation identifier of the item tags (an itemID is a CSSM_DB_RECORDTYPE defined in cssmapple.h).

Parameter info: On return, a pointer to the keychain attribute information. User should call the SecKeychainFreeAttributeInfo function to release the structure when done with it.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if not enough valid parameters were supplied (NULL).

Warning, this call returns more attributes than are support by the old style Keychain API and passing them into older calls will yield an invalid attribute error. The recommended call to retrieve the attribute values is the SecKeychainItemCopyAttributesAndData function.

§Safety

info must be a valid pointer.

Source

pub unsafe fn free_attribute_info( info: NonNull<SecKeychainAttributeInfo>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Releases the memory acquired by calling the SecKeychainAttributeInfoForItemID function.

Parameter info: A pointer to the keychain attribute information to release.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if not enough valid parameters were supplied (NULL).

§Safety

info must be a valid pointer.

Source§

impl SecKeychain

Source

pub unsafe fn add_callback( callback_function: SecKeychainCallback, event_mask: SecKeychainEventMask, user_context: *mut c_void, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate features SecKeychain and libc only.

Registers your keychain event callback function

Parameter callbackFunction: A pointer to your keychain event callback function, described in SecKeychainCallback. You indicate the type of keychain events you want to receive by passing a bit mask of the desired events in the eventMask parameter.

Parameter eventMask: A bit mask indicating the keychain events that your application wishes to be notified of. See SecKeychainEventMask for a description of this bit mask. The Keychain Manager tests this mask to determine the keychain events that you wish to receive, and passes these events in the keychainEvent parameter of your callback function. See SecKeychainEvent for a description of these events.

Parameter userContext: A pointer to application-defined storage that will be passed to your callback function. Your application can use this to associate any particular call of SecKeychainAddCallback with any particular call of your keychain event callback function.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety
  • callback_function must be implemented correctly.
  • user_context must be a valid pointer or null.
Source

pub unsafe fn remove_callback(callback_function: SecKeychainCallback) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate features SecKeychain and libc only.

Unregisters your keychain event callback function. Once removed, keychain events won’t be sent to the owner of the callback.

Parameter callbackFunction: The callback function pointer to remove

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

callback_function must be implemented correctly.

Source

pub unsafe fn add_internet_password( keychain: Option<&SecKeychain>, server_name_length: u32, server_name: *const c_char, security_domain_length: u32, security_domain: *const c_char, account_name_length: u32, account_name: *const c_char, path_length: u32, path: *const c_char, port: u16, protocol: SecProtocolType, authentication_type: SecAuthenticationType, password_length: u32, password_data: NonNull<c_void>, item_ref: *mut *mut SecKeychainItem, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Adds an Internet password to the specified keychain.

Parameter keychain: A reference to a keychain in which to store an Internet password. Pass NULL to specify the user’s default keychain.

Parameter serverNameLength: The length of the buffer pointed to by serverName.

Parameter serverName: A pointer to a string containing the server name associated with this password.

Parameter securityDomainLength: The length of the buffer pointed to by securityDomain.

Parameter securityDomain: A pointer to a string containing the security domain associated with this password, or NULL if there is no relevant security domain.

Parameter accountNameLength: The length of the buffer pointed to by accountName.

Parameter accountName: A pointer to a string containing the account name associated with this password.

Parameter pathLength: The length of the buffer pointed to by path.

Parameter path: A pointer to a string containing the path associated with this password, or NULL if there is no relevant path string.

Parameter port: The TCP/IP port number. If no specific port number is associated with this item, pass 0.

Parameter protocol: The protocol associated with this password. See SecProtocolType for a description of possible values.

Parameter authenticationType: The authentication scheme used. See SecAuthenticationType for a description of possible values. Pass the constant kSecAuthenticationTypeDefault to specify the default authentication scheme.

Parameter passwordLength: The length of the buffer pointed to by passwordData.

Parameter passwordData: A pointer to a buffer containing the password data to be stored in the keychain.

Parameter itemRef: On return, a reference to the new keychain item.

Returns: A result code. See “Security Error Codes” (SecBase.h).

The SecKeychainAddInternetPassword function adds a new Internet server password to the specified keychain. Required parameters to identify the password are serverName and accountName (you cannot pass NULL for both parameters). In addition, some protocols may require an optional securityDomain when authentication is requested. SecKeychainAddInternetPassword optionally returns a reference to the newly added item.

§Safety
  • server_name must be a valid pointer or null.
  • security_domain must be a valid pointer or null.
  • account_name must be a valid pointer or null.
  • path must be a valid pointer or null.
  • password_data must be a valid pointer.
  • item_ref must be a valid pointer or null.
Source

pub unsafe fn find_internet_password( keychain_or_array: Option<&CFType>, server_name_length: u32, server_name: *const c_char, security_domain_length: u32, security_domain: *const c_char, account_name_length: u32, account_name: *const c_char, path_length: u32, path: *const c_char, port: u16, protocol: SecProtocolType, authentication_type: SecAuthenticationType, password_length: *mut u32, password_data: *mut *mut c_void, item_ref: *mut *mut SecKeychainItem, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Finds an Internet password based on the attributes passed.

Parameter keychainOrArray: A reference to an array of keychains to search, a single keychain, or NULL to search the user’s default keychain search list.

Parameter serverNameLength: The length of the buffer pointed to by serverName.

Parameter serverName: A pointer to a string containing the server name.

Parameter securityDomainLength: The length of the buffer pointed to by securityDomain.

Parameter securityDomain: A pointer to a string containing the security domain. This parameter is optional, as not all protocols will require it.

Parameter accountNameLength: The length of the buffer pointed to by accountName.

Parameter accountName: A pointer to a string containing the account name.

Parameter pathLength: The length of the buffer pointed to by path.

Parameter path: A pointer to a string containing the path.

Parameter port: The TCP/IP port number. Pass 0 to ignore the port number.

Parameter protocol: The protocol associated with this password. See SecProtocolType for a description of possible values.

Parameter authenticationType: The authentication scheme used. See SecAuthenticationType for a description of possible values. Pass the constant kSecAuthenticationTypeDefault to specify the default authentication scheme.

Parameter passwordLength: On return, the length of the buffer pointed to by passwordData.

Parameter passwordData: On return, a pointer to a data buffer containing the password. Your application must call SecKeychainItemFreeContent(NULL, passwordData) to release this data buffer when it is no longer needed. Pass NULL if you are not interested in retrieving the password data at this time, but simply want to find the item reference.

Parameter itemRef: On return, a reference to the keychain item which was found.

Returns: A result code. See “Security Error Codes” (SecBase.h).

The SecKeychainFindInternetPassword function finds the first Internet password item which matches the attributes you provide. Most attributes are optional; you should pass only as many as you need to narrow the search sufficiently for your application’s intended use. SecKeychainFindInternetPassword optionally returns a reference to the found item.

§Safety
  • keychain_or_array should be of the correct type.
  • server_name must be a valid pointer or null.
  • security_domain must be a valid pointer or null.
  • account_name must be a valid pointer or null.
  • path must be a valid pointer or null.
  • password_length must be a valid pointer or null.
  • password_data must be a valid pointer or null.
  • item_ref must be a valid pointer or null.
Source

pub unsafe fn add_generic_password( keychain: Option<&SecKeychain>, service_name_length: u32, service_name: *const c_char, account_name_length: u32, account_name: *const c_char, password_length: u32, password_data: NonNull<c_void>, item_ref: *mut *mut SecKeychainItem, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Adds a generic password to the specified keychain.

Parameter keychain: A reference to the keychain in which to store a generic password. Pass NULL to specify the user’s default keychain.

Parameter serviceNameLength: The length of the buffer pointed to by serviceName.

Parameter serviceName: A pointer to a string containing the service name associated with this password.

Parameter accountNameLength: The length of the buffer pointed to by accountName.

Parameter accountName: A pointer to a string containing the account name associated with this password.

Parameter passwordLength: The length of the buffer pointed to by passwordData.

Parameter passwordData: A pointer to a buffer containing the password data to be stored in the keychain.

Parameter itemRef: On return, a reference to the new keychain item.

Returns: A result code. See “Security Error Codes” (SecBase.h).

The SecKeychainAddGenericPassword function adds a new generic password to the default keychain. Required parameters to identify the password are serviceName and accountName, which are application-defined strings. SecKeychainAddGenericPassword optionally returns a reference to the newly added item.

§Safety
  • service_name must be a valid pointer or null.
  • account_name must be a valid pointer or null.
  • password_data must be a valid pointer.
  • item_ref must be a valid pointer or null.
Source

pub unsafe fn find_generic_password( keychain_or_array: Option<&CFType>, service_name_length: u32, service_name: *const c_char, account_name_length: u32, account_name: *const c_char, password_length: *mut u32, password_data: *mut *mut c_void, item_ref: *mut *mut SecKeychainItem, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Find a generic password based on the attributes passed.

Parameter keychainOrArray: A reference to an array of keychains to search, a single keychain, or NULL to search the user’s default keychain search list.

Parameter serviceNameLength: The length of the buffer pointed to by serviceName.

Parameter serviceName: A pointer to a string containing the service name.

Parameter accountNameLength: The length of the buffer pointed to by accountName.

Parameter accountName: A pointer to a string containing the account name.

Parameter passwordLength: On return, the length of the buffer pointed to by passwordData.

Parameter passwordData: On return, a pointer to a data buffer containing the password. Your application must call SecKeychainItemFreeContent(NULL, passwordData) to release this data buffer when it is no longer needed. Pass NULL if you are not interested in retrieving the password data at this time, but simply want to find the item reference.

Parameter itemRef: On return, a reference to the keychain item which was found.

Returns: A result code. See “Security Error Codes” (SecBase.h).

The SecKeychainFindGenericPassword function finds the first generic password item which matches the attributes you provide. Most attributes are optional; you should pass only as many as you need to narrow the search sufficiently for your application’s intended use. SecKeychainFindGenericPassword optionally returns a reference to the found item.

§Safety
  • keychain_or_array should be of the correct type.
  • service_name must be a valid pointer or null.
  • account_name must be a valid pointer or null.
  • password_length must be a valid pointer or null.
  • password_data must be a valid pointer or null.
  • item_ref must be a valid pointer or null.
Source

pub unsafe fn set_user_interaction_allowed(state: bool) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Turns on or off any optional user interaction

Parameter state: A boolean representing the state of user interaction. You should pass TRUE to allow user interaction, and FALSE to disallow user interaction

Returns: A result code. See “Security Error Codes” (SecBase.h).

Source

pub unsafe fn user_interaction_allowed(state: NonNull<u8>) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Retrieves the current state of user interaction.

Parameter state: On return, a pointer to the current state of user interaction. If this is TRUE then user interaction is allowed, if it is FALSE, then user interaction is not allowed.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

state must be a valid pointer.

Source

pub unsafe fn csp_handle( keychain: Option<&SecKeychain>, csp_handle: NonNull<CSSM_CSP_HANDLE>, ) -> i32

👎Deprecated
Available on crate features SecKeychain and cssmconfig and cssmtype only.

Returns the CSSM_CSP_HANDLE attachment for the given keychain reference. The handle is valid until the keychain reference is released.

Parameter keychain: A keychain reference.

Parameter cspHandle: On return, a pointer to the CSSM_CSP_HANDLE for the given keychain.

Returns: A result code. See “Security Error Codes” (SecBase.h).

This API is deprecated for 10.7. It should nho longer be needed.

§Safety

csp_handle must be a valid pointer.

Source

pub unsafe fn dldb_handle( keychain: Option<&SecKeychain>, dldb_handle: NonNull<CSSM_DL_DB_HANDLE>, ) -> i32

👎Deprecated
Available on crate features SecKeychain and cssmconfig and cssmtype only.

Returns the CSSM_DL_DB_HANDLE for a given keychain reference. The handle is valid until the keychain reference is released.

Parameter keychain: A keychain reference.

Parameter dldbHandle: On return, a pointer to the CSSM_DL_DB_HANDLE for the given keychain.

Returns: A result code. See “Security Error Codes” (SecBase.h).

This API is deprecated for 10.7. It should nho longer be needed.

§Safety

dldb_handle must be a valid pointer.

Source

pub unsafe fn copy_access( keychain: Option<&SecKeychain>, access: NonNull<*mut SecAccess>, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Retrieves the access for a keychain.

Parameter keychain: A reference to the keychain from which to copy the access.

Parameter access: On return, a pointer to the access reference.

Returns: A result code. See “Security Error Codes” (SecBase.h).

§Safety

access must be a valid pointer.

Source

pub unsafe fn set_access( keychain: Option<&SecKeychain>, access: &SecAccess, ) -> i32

👎Deprecated: SecKeychain is deprecated
Available on crate feature SecKeychain only.

Sets the access for a keychain.

Parameter keychain: A reference to the keychain for which to set the access.

Parameter access: An access reference.

Returns: A result code. See “Security Error Codes” (SecBase.h).

Methods from Deref<Target = CFType>§

Source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: ConcreteType,

Available on crate feature SecCustomTransform only.

Attempt to downcast the type to that of type T.

This is the reference-variant. Use CFRetained::downcast if you want to convert a retained type. See also ConcreteType for more details on which types support being converted to.

Source

pub fn retain_count(&self) -> usize

Available on crate feature SecCustomTransform only.

Get the reference count of the object.

This function may be useful for debugging. You normally do not use this function otherwise.

Beware that some things (like CFNumbers, small CFStrings etc.) may not have a normal retain count for optimization purposes, and can return usize::MAX in that case.

Trait Implementations§

Source§

impl AsRef<AnyObject> for SecKeychain

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CFType> for SecKeychain

Source§

fn as_ref(&self) -> &CFType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<SecKeychain> for SecKeychain

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<AnyObject> for SecKeychain

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<CFType> for SecKeychain

Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

impl ConcreteType for SecKeychain

Available on crate feature SecKeychain only.
Source§

fn type_id() -> CFTypeID

Returns the type identifier of SecKeychain instances.

Returns: The CFTypeID of SecKeychain instances.

Source§

impl Debug for SecKeychain

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for SecKeychain

Source§

type Target = CFType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Hash for SecKeychain

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for SecKeychain

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl PartialEq for SecKeychain

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for SecKeychain

Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl Type for SecKeychain

Source§

fn retain(&self) -> CFRetained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain
Helper for easier transition from the core-foundation crate. Read more
Source§

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw
Helper for easier transition from the core-foundation crate. Read more
Source§

impl Eq for SecKeychain

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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.
Source§

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