Struct SecKeychainItem

Source
#[repr(C)]
pub struct SecKeychainItem { /* private fields */ }
Available on crate feature SecBase only.
Expand description

Contains information about a keychain item.

See also Apple’s documentation

Implementations§

Source§

impl SecKeychainItem

Source

pub unsafe fn export( keychain_item_or_array: &CFType, output_format: SecExternalFormat, flags: SecItemImportExportFlags, key_params: *const SecKeyImportExportParameters, exported_data: NonNull<*const CFData>, ) -> i32

👎Deprecated
Available on crate features SecImportExport and cssmconfig and cssmtype only.
Source§

impl SecKeychainItem

Source

pub unsafe fn import( imported_data: &CFData, file_name_or_extension: Option<&CFString>, input_format: *mut SecExternalFormat, item_type: *mut SecExternalItemType, flags: SecItemImportExportFlags, key_params: *const SecKeyImportExportParameters, import_keychain: Option<&SecKeychain>, out_items: *mut *const CFArray, ) -> i32

👎Deprecated
Available on crate features SecImportExport and cssmconfig and cssmtype only.
Source§

impl SecKeychainItem

Source

pub unsafe fn modify_attributes_and_data( self: &SecKeychainItem, attr_list: *const SecKeychainAttributeList, length: u32, data: *const c_void, ) -> i32

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

Updates an existing keychain item after changing its attributes or data.

Parameter itemRef: A reference to the keychain item to modify.

Parameter attrList: The list of attributes to modify, along with their new values. Pass NULL if you don’t need to modify any attributes.

Parameter length: The length of the buffer pointed to by data.

Parameter data: Pointer to a buffer containing the data to store. Pass NULL if you don’t need to modify the data.

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

The keychain item is written to the keychain’s permanent data store. If the keychain item has not previously been added to a keychain, a call to the SecKeychainItemModifyContent function does nothing and returns errSecSuccess.

Source

pub unsafe fn create_from_content( item_class: SecItemClass, attr_list: NonNull<SecKeychainAttributeList>, length: u32, data: *const c_void, keychain_ref: Option<&SecKeychain>, initial_access: Option<&SecAccess>, item_ref: *mut *mut SecKeychainItem, ) -> i32

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

Creates a new keychain item from the supplied parameters.

Parameter itemClass: A constant identifying the class of item to create.

Parameter attrList: The list of attributes of the item to create.

Parameter length: The length of the buffer pointed to by data.

Parameter data: A pointer to a buffer containing the data to store.

Parameter initialAccess: A reference to the access for this keychain item.

Parameter keychainRef: A reference to the keychain in which to add the item.

Parameter itemRef: On return, a pointer to a reference to the newly created keychain item (optional). When the item reference is no longer required, call CFRelease to deallocate memory occupied by the item.

Returns: A result code. See “Security Error Codes” (SecBase.h). In addition, errSecParam (-50) may be returned if not enough valid parameters are supplied, or errSecAllocate (-108) if there is not enough memory in the current heap zone to create the object.

Source

pub unsafe fn modify_content( self: &SecKeychainItem, attr_list: *const SecKeychainAttributeList, length: u32, data: *const c_void, ) -> i32

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

Updates an existing keychain item after changing its attributes or data. This call should only be used in conjunction with SecKeychainItemCopyContent().

Parameter itemRef: A reference to the keychain item to modify.

Parameter attrList: The list of attributes to modify, along with their new values. Pass NULL if you don’t need to modify any attributes.

Parameter length: The length of the buffer pointed to by data.

Parameter data: A pointer to a buffer containing the data to store. Pass NULL if you don’t need to modify the data.

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

Source

pub unsafe fn copy_content( self: &SecKeychainItem, item_class: *mut SecItemClass, attr_list: *mut SecKeychainAttributeList, length: *mut u32, out_data: *mut *mut c_void, ) -> i32

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

Copies the data and/or attributes stored in the given keychain item. It is recommended that you use SecKeychainItemCopyAttributesAndData(). You must call SecKeychainItemFreeContent when you no longer need the attributes and data. If you want to modify the attributes returned here, use SecKeychainModifyContent().

Parameter itemRef: A reference to the keychain item to modify.

Parameter itemClass: On return, the item’s class. Pass NULL if you don’t require this information.

Parameter attrList: On input, the list of attributes to retrieve. On output, the attributes are filled in. Pass NULL if you don’t need to retrieve any attributes. You must call SecKeychainItemFreeContent when you no longer need the attributes.

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

Parameter outData: On return, a pointer to a buffer containing the data in this item. Pass NULL if you don’t need to retrieve the data. You must call SecKeychainItemFreeContent when you no longer need the data.

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

Source

pub unsafe fn free_content( attr_list: *mut SecKeychainAttributeList, data: *mut c_void, ) -> i32

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

Releases the memory used by the keychain attribute list and the keychain data retrieved in a previous call to SecKeychainItemCopyContent.

Parameter attrList: A pointer to the attribute list to release. Pass NULL to ignore this parameter.

Parameter data: A pointer to the data buffer to release. Pass NULL to ignore this parameter.

Source

pub unsafe fn copy_attributes_and_data( self: &SecKeychainItem, info: *mut SecKeychainAttributeInfo, item_class: *mut SecItemClass, attr_list: *mut *mut SecKeychainAttributeList, length: *mut u32, out_data: *mut *mut c_void, ) -> i32

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

Copies the data and/or attributes stored in the given keychain item. You must call SecKeychainItemFreeAttributesAndData when you no longer need the attributes and data. If you want to modify the attributes returned here, use SecKeychainModifyAttributesAndData.

Parameter itemRef: A reference to the keychain item to copy.

Parameter info: A list of tags and formats of the attributes you wish to retrieve. Pass NULL if you don’t need to retrieve any attributes. You can call SecKeychainAttributeInfoForItemID to obtain a list with all possible attribute tags and formats for the item’s class.

Parameter itemClass: On return, the item’s class. Pass NULL if you don’t require this information.

Parameter attrList: On return, a pointer to the list of retrieved attributes. Pass NULL if you don’t need to retrieve any attributes. You must call SecKeychainItemFreeAttributesAndData when you no longer need this list.

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

Parameter outData: On return, a pointer to a buffer containing the data in this item. Pass NULL if you don’t need to retrieve the data. You must call SecKeychainItemFreeAttributesAndData when you no longer need the data.

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

Source

pub unsafe fn free_attributes_and_data( attr_list: *mut SecKeychainAttributeList, data: *mut c_void, ) -> i32

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

Releases the memory used by the keychain attribute list and the keychain data retrieved in a previous call to SecKeychainItemCopyAttributesAndData.

Parameter attrList: A pointer to the attribute list to release. Pass NULL to ignore this parameter.

Parameter data: A pointer to the data buffer to release. Pass NULL to ignore this parameter.

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

Source

pub unsafe fn delete(self: &SecKeychainItem) -> i32

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

Deletes a keychain item from the default keychain’s permanent data store.

Parameter itemRef: A keychain item reference of the item to delete.

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

If itemRef has not previously been added to the keychain, SecKeychainItemDelete does nothing and returns errSecSuccess. IMPORTANT: SecKeychainItemDelete does not dispose the memory occupied by the item reference itself; use the CFRelease function when you are completely finished with an item.

Source

pub unsafe fn copy_keychain( self: &SecKeychainItem, keychain_ref: NonNull<*mut SecKeychain>, ) -> i32

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

Copies an existing keychain reference from a keychain item.

Parameter itemRef: A keychain item reference.

Parameter keychainRef: On return, the keychain reference for the specified item. Release this reference by calling the CFRelease function.

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

Source

pub unsafe fn create_copy( self: &SecKeychainItem, dest_keychain_ref: Option<&SecKeychain>, initial_access: Option<&SecAccess>, item_copy: NonNull<*mut SecKeychainItem>, ) -> i32

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

Copies a keychain item.

Parameter itemRef: A reference to the keychain item to copy.

Parameter destKeychainRef: A reference to the keychain in which to insert the copied keychain item.

Parameter initialAccess: The initial access for the copied keychain item.

Parameter itemCopy: On return, a reference to the copied keychain item.

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

Source

pub unsafe fn create_persistent_reference( self: &SecKeychainItem, persistent_item_ref: NonNull<*const CFData>, ) -> i32

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

Returns a CFDataRef which can be used as a persistent reference to the given keychain item. The data obtained can be turned back into a SecKeychainItemRef later by calling SecKeychainItemCopyFromPersistentReference().

Parameter itemRef: A reference to a keychain item.

Parameter persistentItemRef: On return, a CFDataRef containing a persistent reference. You must release this data reference by calling the CFRelease function.

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

Source

pub unsafe fn copy_from_persistent_reference( persistent_item_ref: &CFData, item_ref: NonNull<*mut SecKeychainItem>, ) -> i32

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

Returns a SecKeychainItemRef, given a persistent reference previously obtained by calling SecKeychainItemCreatePersistentReference().

Parameter persistentItemRef: A CFDataRef containing a persistent reference to a keychain item.

Parameter itemRef: On return, a SecKeychainItemRef for the keychain item described by the persistent reference. You must release this item reference by calling the CFRelease function.

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

Source

pub unsafe fn dldb_handle( self: &SecKeychainItem, dldb_handle: NonNull<CSSM_DL_DB_HANDLE>, ) -> i32

👎Deprecated: CSSM is not supported
Available on crate features SecKeychainItem and cssmconfig and cssmtype only.

Returns the CSSM_DL_DB_HANDLE for a given keychain item reference.

Parameter keyItemRef: A keychain item reference.

Parameter dldbHandle: On return, a CSSM_DL_DB_HANDLE for the keychain database containing the given item. The handle is valid until the keychain reference is released.

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

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

Source

pub unsafe fn unique_record_id( self: &SecKeychainItem, unique_record_id: NonNull<*const CSSM_DB_UNIQUE_RECORD>, ) -> i32

👎Deprecated: CSSM is not supported
Available on crate features SecKeychainItem and SecAsn1Types and cssmconfig and cssmtype only.

Returns a CSSM_DB_UNIQUE_RECORD for the given keychain item reference.

Parameter itemRef: A keychain item reference.

Parameter uniqueRecordID: On return, a pointer to a CSSM_DB_UNIQUE_RECORD structure for the given item. The unique record is valid until the item reference is released.

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

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

Source

pub unsafe fn copy_access( self: &SecKeychainItem, access: NonNull<*mut SecAccess>, ) -> i32

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

Copies the access of a given keychain item.

Parameter itemRef: A reference to a keychain item.

Parameter access: On return, a reference to the keychain item’s access.

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

Source

pub unsafe fn set_access(self: &SecKeychainItem, access: &SecAccess) -> i32

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

Sets the access of a given keychain item.

Parameter itemRef: A reference to a keychain item.

Parameter access: A reference to an access to replace the keychain item’s current access.

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 SecKeychainItem

Source§

fn as_ref(&self) -> &AnyObject

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

impl AsRef<CFType> for SecKeychainItem

Source§

fn as_ref(&self) -> &CFType

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

impl AsRef<SecKeychainItem> for SecKeychainItem

Source§

fn as_ref(&self) -> &Self

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

impl Borrow<AnyObject> for SecKeychainItem

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<CFType> for SecKeychainItem

Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

impl ConcreteType for SecKeychainItem

Available on crate feature SecKeychainItem only.
Source§

fn type_id() -> CFTypeID

Returns the type identifier of SecKeychainItem instances.

Returns: The CFTypeID of SecKeychainItem instances.

Source§

impl Debug for SecKeychainItem

Source§

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

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

impl Deref for SecKeychainItem

Source§

type Target = CFType

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl Hash for SecKeychainItem

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 SecKeychainItem

Source§

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

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

impl PartialEq for SecKeychainItem

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 SecKeychainItem

Source§

const ENCODING_REF: Encoding

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

impl Type for SecKeychainItem

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 SecKeychainItem

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,