1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2_core_foundation::*;
use crate::*;
#[cfg(feature = "SecBase")]
unsafe impl ConcreteType for SecKeychainSearch {
/// Returns the type identifier of SecKeychainSearch instances.
///
/// Returns: The CFTypeID of SecKeychainSearch instances.
///
/// This API is deprecated in 10.7. The SecKeychainSearchRef type is no longer used.
#[doc(alias = "SecKeychainSearchGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn SecKeychainSearchGetTypeID() -> CFTypeID;
}
unsafe { SecKeychainSearchGetTypeID() }
}
}
#[cfg(feature = "SecBase")]
impl SecKeychainSearch {
/// Creates a search reference matching a list of zero or more specified attributes in the specified keychain.
///
/// Parameter `keychainOrArray`: An reference to an array of keychains to search, a single keychain or NULL to search the user's default keychain search list.
///
/// Parameter `itemClass`: The keychain item class.
///
/// Parameter `attrList`: A pointer to a list of zero or more keychain attribute records to match. Pass NULL to match any keychain attribute.
///
/// Parameter `searchRef`: On return, a pointer to the current search reference. You are responsible for calling the CFRelease function to release this reference when finished with it.
///
/// Returns: A result code. See "Security Error Codes" (SecBase.h).
///
/// This function is deprecated in Mac OS X 10.7 and later; to find keychain items which match specified attributes, please use the SecItemCopyMatching API (see SecItem.h).
///
/// # Safety
///
/// - `keychain_or_array` should be of the correct type.
/// - `attr_list` must be a valid pointer or null.
/// - `search_ref` must be a valid pointer.
#[doc(alias = "SecKeychainSearchCreateFromAttributes")]
#[cfg(all(feature = "SecBase", feature = "SecKeychainItem"))]
#[deprecated = "SecKeychainSearch is not supported"]
#[inline]
pub unsafe fn create_from_attributes(
keychain_or_array: Option<&CFType>,
item_class: SecItemClass,
attr_list: *const SecKeychainAttributeList,
search_ref: NonNull<*mut SecKeychainSearch>,
) -> OSStatus {
extern "C-unwind" {
fn SecKeychainSearchCreateFromAttributes(
keychain_or_array: Option<&CFType>,
item_class: SecItemClass,
attr_list: *const SecKeychainAttributeList,
search_ref: NonNull<*mut SecKeychainSearch>,
) -> OSStatus;
}
unsafe {
SecKeychainSearchCreateFromAttributes(
keychain_or_array,
item_class,
attr_list,
search_ref,
)
}
}
/// Finds the next keychain item matching the given search criteria.
///
/// Parameter `searchRef`: A reference to the current search criteria. The search reference is created in the SecKeychainSearchCreateFromAttributes function and must be released by calling the CFRelease function when you are done with it.
///
/// Parameter `itemRef`: On return, a pointer to a keychain item reference of the next matching keychain item, if any.
///
/// Returns: A result code. When there are no more items that match the parameters specified to SecPolicySearchCreate, errSecItemNotFound is returned. See "Security Error Codes" (SecBase.h).
///
/// This function is deprecated in Mac OS X 10.7 and later; to find keychain items which match specified attributes, please use the SecItemCopyMatching API (see SecItem.h).
///
/// # Safety
///
/// `item_ref` must be a valid pointer.
#[doc(alias = "SecKeychainSearchCopyNext")]
#[cfg(feature = "SecBase")]
#[deprecated = "SecKeychainSearch is not supported"]
#[inline]
pub unsafe fn copy_next(&self, item_ref: NonNull<*mut SecKeychainItem>) -> OSStatus {
extern "C-unwind" {
fn SecKeychainSearchCopyNext(
search_ref: &SecKeychainSearch,
item_ref: NonNull<*mut SecKeychainItem>,
) -> OSStatus;
}
unsafe { SecKeychainSearchCopyNext(self, item_ref) }
}
}
extern "C-unwind" {
#[cfg(all(feature = "SecBase", feature = "SecKeychainItem"))]
#[deprecated = "renamed to `SecKeychainSearch::create_from_attributes`"]
pub fn SecKeychainSearchCreateFromAttributes(
keychain_or_array: Option<&CFType>,
item_class: SecItemClass,
attr_list: *const SecKeychainAttributeList,
search_ref: NonNull<*mut SecKeychainSearch>,
) -> OSStatus;
}
extern "C-unwind" {
#[cfg(feature = "SecBase")]
#[deprecated = "renamed to `SecKeychainSearch::copy_next`"]
pub fn SecKeychainSearchCopyNext(
search_ref: &SecKeychainSearch,
item_ref: NonNull<*mut SecKeychainItem>,
) -> OSStatus;
}