1use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11pub const kSecUnlockStateStatus: u32 = 1;
13pub const kSecReadPermStatus: u32 = 2;
15pub const kSecWritePermStatus: u32 = 4;
17
18#[repr(C)]
26#[derive(Clone, Copy, Debug, PartialEq)]
27pub struct SecKeychainSettings {
28 pub version: u32,
29 pub lockOnSleep: Boolean,
30 pub useLockInterval: Boolean,
31 pub lockInterval: u32,
32}
33
34#[cfg(feature = "objc2")]
35unsafe impl Encode for SecKeychainSettings {
36 const ENCODING: Encoding = Encoding::Struct(
37 "SecKeychainSettings",
38 &[
39 <u32>::ENCODING,
40 <Boolean>::ENCODING,
41 <Boolean>::ENCODING,
42 <u32>::ENCODING,
43 ],
44 );
45}
46
47#[cfg(feature = "objc2")]
48unsafe impl RefEncode for SecKeychainSettings {
49 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52#[repr(transparent)]
55#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
56pub struct SecAuthenticationType(pub FourCharCode);
57impl SecAuthenticationType {
58 #[doc(alias = "kSecAuthenticationTypeNTLM")]
59 pub const NTLM: Self = Self(AUTH_TYPE_FIX_!(0x6e746c6d));
60 #[doc(alias = "kSecAuthenticationTypeMSN")]
61 pub const MSN: Self = Self(AUTH_TYPE_FIX_!(0x6d736e61));
62 #[doc(alias = "kSecAuthenticationTypeDPA")]
63 pub const DPA: Self = Self(AUTH_TYPE_FIX_!(0x64706161));
64 #[doc(alias = "kSecAuthenticationTypeRPA")]
65 pub const RPA: Self = Self(AUTH_TYPE_FIX_!(0x72706161));
66 #[doc(alias = "kSecAuthenticationTypeHTTPBasic")]
67 pub const HTTPBasic: Self = Self(AUTH_TYPE_FIX_!(0x68747470));
68 #[doc(alias = "kSecAuthenticationTypeHTTPDigest")]
69 pub const HTTPDigest: Self = Self(AUTH_TYPE_FIX_!(0x68747464));
70 #[doc(alias = "kSecAuthenticationTypeHTMLForm")]
71 pub const HTMLForm: Self = Self(AUTH_TYPE_FIX_!(0x666f726d));
72 #[doc(alias = "kSecAuthenticationTypeDefault")]
73 pub const Default: Self = Self(AUTH_TYPE_FIX_!(0x64666c74));
74 #[doc(alias = "kSecAuthenticationTypeAny")]
75 pub const Any: Self = Self(AUTH_TYPE_FIX_!(0));
76}
77
78#[cfg(feature = "objc2")]
79unsafe impl Encode for SecAuthenticationType {
80 const ENCODING: Encoding = FourCharCode::ENCODING;
81}
82
83#[cfg(feature = "objc2")]
84unsafe impl RefEncode for SecAuthenticationType {
85 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
86}
87
88#[repr(transparent)]
93#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
94pub struct SecProtocolType(pub FourCharCode);
95impl SecProtocolType {
96 #[doc(alias = "kSecProtocolTypeFTP")]
97 pub const FTP: Self = Self(0x66747020);
98 #[doc(alias = "kSecProtocolTypeFTPAccount")]
99 pub const FTPAccount: Self = Self(0x66747061);
100 #[doc(alias = "kSecProtocolTypeHTTP")]
101 pub const HTTP: Self = Self(0x68747470);
102 #[doc(alias = "kSecProtocolTypeIRC")]
103 pub const IRC: Self = Self(0x69726320);
104 #[doc(alias = "kSecProtocolTypeNNTP")]
105 pub const NNTP: Self = Self(0x6e6e7470);
106 #[doc(alias = "kSecProtocolTypePOP3")]
107 pub const POP3: Self = Self(0x706f7033);
108 #[doc(alias = "kSecProtocolTypeSMTP")]
109 pub const SMTP: Self = Self(0x736d7470);
110 #[doc(alias = "kSecProtocolTypeSOCKS")]
111 pub const SOCKS: Self = Self(0x736f7820);
112 #[doc(alias = "kSecProtocolTypeIMAP")]
113 pub const IMAP: Self = Self(0x696d6170);
114 #[doc(alias = "kSecProtocolTypeLDAP")]
115 pub const LDAP: Self = Self(0x6c646170);
116 #[doc(alias = "kSecProtocolTypeAppleTalk")]
117 pub const AppleTalk: Self = Self(0x61746c6b);
118 #[doc(alias = "kSecProtocolTypeAFP")]
119 pub const AFP: Self = Self(0x61667020);
120 #[doc(alias = "kSecProtocolTypeTelnet")]
121 pub const Telnet: Self = Self(0x74656c6e);
122 #[doc(alias = "kSecProtocolTypeSSH")]
123 pub const SSH: Self = Self(0x73736820);
124 #[doc(alias = "kSecProtocolTypeFTPS")]
125 pub const FTPS: Self = Self(0x66747073);
126 #[doc(alias = "kSecProtocolTypeHTTPS")]
127 pub const HTTPS: Self = Self(0x68747073);
128 #[doc(alias = "kSecProtocolTypeHTTPProxy")]
129 pub const HTTPProxy: Self = Self(0x68747078);
130 #[doc(alias = "kSecProtocolTypeHTTPSProxy")]
131 pub const HTTPSProxy: Self = Self(0x68747378);
132 #[doc(alias = "kSecProtocolTypeFTPProxy")]
133 pub const FTPProxy: Self = Self(0x66747078);
134 #[doc(alias = "kSecProtocolTypeCIFS")]
135 pub const CIFS: Self = Self(0x63696673);
136 #[doc(alias = "kSecProtocolTypeSMB")]
137 pub const SMB: Self = Self(0x736d6220);
138 #[doc(alias = "kSecProtocolTypeRTSP")]
139 pub const RTSP: Self = Self(0x72747370);
140 #[doc(alias = "kSecProtocolTypeRTSPProxy")]
141 pub const RTSPProxy: Self = Self(0x72747378);
142 #[doc(alias = "kSecProtocolTypeDAAP")]
143 pub const DAAP: Self = Self(0x64616170);
144 #[doc(alias = "kSecProtocolTypeEPPC")]
145 pub const EPPC: Self = Self(0x65707063);
146 #[doc(alias = "kSecProtocolTypeIPP")]
147 pub const IPP: Self = Self(0x69707020);
148 #[doc(alias = "kSecProtocolTypeNNTPS")]
149 pub const NNTPS: Self = Self(0x6e747073);
150 #[doc(alias = "kSecProtocolTypeLDAPS")]
151 pub const LDAPS: Self = Self(0x6c647073);
152 #[doc(alias = "kSecProtocolTypeTelnetS")]
153 pub const TelnetS: Self = Self(0x74656c73);
154 #[doc(alias = "kSecProtocolTypeIMAPS")]
155 pub const IMAPS: Self = Self(0x696d7073);
156 #[doc(alias = "kSecProtocolTypeIRCS")]
157 pub const IRCS: Self = Self(0x69726373);
158 #[doc(alias = "kSecProtocolTypePOP3S")]
159 pub const POP3S: Self = Self(0x706f7073);
160 #[doc(alias = "kSecProtocolTypeCVSpserver")]
161 pub const CVSpserver: Self = Self(0x63767370);
162 #[doc(alias = "kSecProtocolTypeSVN")]
163 pub const SVN: Self = Self(0x73766e20);
164 #[doc(alias = "kSecProtocolTypeAny")]
165 pub const Any: Self = Self(0);
166}
167
168#[cfg(feature = "objc2")]
169unsafe impl Encode for SecProtocolType {
170 const ENCODING: Encoding = FourCharCode::ENCODING;
171}
172
173#[cfg(feature = "objc2")]
174unsafe impl RefEncode for SecProtocolType {
175 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
176}
177
178#[repr(transparent)]
183#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
184pub struct SecKeychainEvent(pub u32);
185impl SecKeychainEvent {
186 #[doc(alias = "kSecLockEvent")]
187 pub const LockEvent: Self = Self(1);
188 #[doc(alias = "kSecUnlockEvent")]
189 pub const UnlockEvent: Self = Self(2);
190 #[doc(alias = "kSecAddEvent")]
191 pub const AddEvent: Self = Self(3);
192 #[doc(alias = "kSecDeleteEvent")]
193 pub const DeleteEvent: Self = Self(4);
194 #[doc(alias = "kSecUpdateEvent")]
195 pub const UpdateEvent: Self = Self(5);
196 #[doc(alias = "kSecPasswordChangedEvent")]
197 pub const PasswordChangedEvent: Self = Self(6);
198 #[doc(alias = "kSecDefaultChangedEvent")]
199 pub const DefaultChangedEvent: Self = Self(9);
200 #[doc(alias = "kSecDataAccessEvent")]
201 #[deprecated = "Read events are no longer posted"]
202 pub const DataAccessEvent: Self = Self(10);
203 #[doc(alias = "kSecKeychainListChangedEvent")]
204 pub const KeychainListChangedEvent: Self = Self(11);
205 #[doc(alias = "kSecTrustSettingsChangedEvent")]
206 pub const TrustSettingsChangedEvent: Self = Self(12);
207}
208
209#[cfg(feature = "objc2")]
210unsafe impl Encode for SecKeychainEvent {
211 const ENCODING: Encoding = u32::ENCODING;
212}
213
214#[cfg(feature = "objc2")]
215unsafe impl RefEncode for SecKeychainEvent {
216 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
217}
218
219#[repr(transparent)]
224#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
225pub struct SecKeychainEventMask(pub u32);
226bitflags::bitflags! {
227 impl SecKeychainEventMask: u32 {
228 #[doc(alias = "kSecLockEventMask")]
229 const LockEventMask = 1<<SecKeychainEvent::LockEvent.0;
230 #[doc(alias = "kSecUnlockEventMask")]
231 const UnlockEventMask = 1<<SecKeychainEvent::UnlockEvent.0;
232 #[doc(alias = "kSecAddEventMask")]
233 const AddEventMask = 1<<SecKeychainEvent::AddEvent.0;
234 #[doc(alias = "kSecDeleteEventMask")]
235 const DeleteEventMask = 1<<SecKeychainEvent::DeleteEvent.0;
236 #[doc(alias = "kSecUpdateEventMask")]
237 const UpdateEventMask = 1<<SecKeychainEvent::UpdateEvent.0;
238 #[doc(alias = "kSecPasswordChangedEventMask")]
239 const PasswordChangedEventMask = 1<<SecKeychainEvent::PasswordChangedEvent.0;
240 #[doc(alias = "kSecDefaultChangedEventMask")]
241 const DefaultChangedEventMask = 1<<SecKeychainEvent::DefaultChangedEvent.0;
242 #[doc(alias = "kSecDataAccessEventMask")]
243#[deprecated = "Read events are no longer posted"]
244 const DataAccessEventMask = 1<<SecKeychainEvent::DataAccessEvent.0;
245 #[doc(alias = "kSecKeychainListChangedMask")]
246 const KeychainListChangedMask = 1<<SecKeychainEvent::KeychainListChangedEvent.0;
247 #[doc(alias = "kSecTrustSettingsChangedEventMask")]
248 const TrustSettingsChangedEventMask = 1<<SecKeychainEvent::TrustSettingsChangedEvent.0;
249 #[doc(alias = "kSecEveryEventMask")]
250 const EveryEventMask = 0xffffffff;
251 }
252}
253
254#[cfg(feature = "objc2")]
255unsafe impl Encode for SecKeychainEventMask {
256 const ENCODING: Encoding = u32::ENCODING;
257}
258
259#[cfg(feature = "objc2")]
260unsafe impl RefEncode for SecKeychainEventMask {
261 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
262}
263
264#[cfg(all(feature = "SecBase", feature = "libc"))]
274#[repr(C)]
275#[derive(Clone, Copy, Debug, PartialEq)]
276pub struct SecKeychainCallbackInfo {
277 pub version: u32,
278 pub item: NonNull<SecKeychainItem>,
279 pub keychain: NonNull<SecKeychain>,
280 pub pid: libc::pid_t,
281}
282
283#[cfg(all(feature = "SecBase", feature = "libc", feature = "objc2"))]
284unsafe impl Encode for SecKeychainCallbackInfo {
285 const ENCODING: Encoding = Encoding::Struct(
286 "SecKeychainCallbackInfo",
287 &[
288 <u32>::ENCODING,
289 <NonNull<SecKeychainItem>>::ENCODING,
290 <NonNull<SecKeychain>>::ENCODING,
291 <libc::pid_t>::ENCODING,
292 ],
293 );
294}
295
296#[cfg(all(feature = "SecBase", feature = "libc", feature = "objc2"))]
297unsafe impl RefEncode for SecKeychainCallbackInfo {
298 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
299}
300
301#[cfg(feature = "SecBase")]
302unsafe impl ConcreteType for SecKeychain {
303 #[doc(alias = "SecKeychainGetTypeID")]
307 #[inline]
308 fn type_id() -> CFTypeID {
309 extern "C-unwind" {
310 fn SecKeychainGetTypeID() -> CFTypeID;
311 }
312 unsafe { SecKeychainGetTypeID() }
313 }
314}
315
316#[cfg(feature = "SecBase")]
317impl SecKeychain {
318 #[doc(alias = "SecKeychainGetVersion")]
328 #[deprecated = "SecKeychain is deprecated"]
329 #[inline]
330 pub unsafe fn version(return_vers: NonNull<u32>) -> OSStatus {
331 extern "C-unwind" {
332 fn SecKeychainGetVersion(return_vers: NonNull<u32>) -> OSStatus;
333 }
334 unsafe { SecKeychainGetVersion(return_vers) }
335 }
336
337 #[doc(alias = "SecKeychainOpen")]
352 #[cfg(feature = "SecBase")]
353 #[deprecated = "SecKeychain is deprecated"]
354 #[inline]
355 pub unsafe fn open(
356 path_name: NonNull<c_char>,
357 keychain: NonNull<*mut SecKeychain>,
358 ) -> OSStatus {
359 extern "C-unwind" {
360 fn SecKeychainOpen(
361 path_name: NonNull<c_char>,
362 keychain: NonNull<*mut SecKeychain>,
363 ) -> OSStatus;
364 }
365 unsafe { SecKeychainOpen(path_name, keychain) }
366 }
367
368 #[doc(alias = "SecKeychainCreate")]
390 #[cfg(feature = "SecBase")]
391 #[deprecated = "SecKeychain is deprecated"]
392 #[inline]
393 pub unsafe fn create(
394 path_name: NonNull<c_char>,
395 password_length: u32,
396 password: *const c_void,
397 prompt_user: bool,
398 initial_access: Option<&SecAccess>,
399 keychain: NonNull<*mut SecKeychain>,
400 ) -> OSStatus {
401 extern "C-unwind" {
402 fn SecKeychainCreate(
403 path_name: NonNull<c_char>,
404 password_length: u32,
405 password: *const c_void,
406 prompt_user: Boolean,
407 initial_access: Option<&SecAccess>,
408 keychain: NonNull<*mut SecKeychain>,
409 ) -> OSStatus;
410 }
411 unsafe {
412 SecKeychainCreate(
413 path_name,
414 password_length,
415 password,
416 prompt_user as _,
417 initial_access,
418 keychain,
419 )
420 }
421 }
422
423 #[doc(alias = "SecKeychainDelete")]
429 #[cfg(feature = "SecBase")]
430 #[deprecated = "SecKeychain is deprecated"]
431 #[inline]
432 pub unsafe fn delete(keychain_or_array: Option<&SecKeychain>) -> OSStatus {
433 extern "C-unwind" {
434 fn SecKeychainDelete(keychain_or_array: Option<&SecKeychain>) -> OSStatus;
435 }
436 unsafe { SecKeychainDelete(keychain_or_array) }
437 }
438
439 #[doc(alias = "SecKeychainSetSettings")]
451 #[cfg(feature = "SecBase")]
452 #[deprecated = "SecKeychain is deprecated"]
453 #[inline]
454 pub unsafe fn set_settings(
455 keychain: Option<&SecKeychain>,
456 new_settings: NonNull<SecKeychainSettings>,
457 ) -> OSStatus {
458 extern "C-unwind" {
459 fn SecKeychainSetSettings(
460 keychain: Option<&SecKeychain>,
461 new_settings: NonNull<SecKeychainSettings>,
462 ) -> OSStatus;
463 }
464 unsafe { SecKeychainSetSettings(keychain, new_settings) }
465 }
466
467 #[doc(alias = "SecKeychainCopySettings")]
479 #[cfg(feature = "SecBase")]
480 #[deprecated = "SecKeychain is deprecated"]
481 #[inline]
482 pub unsafe fn copy_settings(
483 keychain: Option<&SecKeychain>,
484 out_settings: NonNull<SecKeychainSettings>,
485 ) -> OSStatus {
486 extern "C-unwind" {
487 fn SecKeychainCopySettings(
488 keychain: Option<&SecKeychain>,
489 out_settings: NonNull<SecKeychainSettings>,
490 ) -> OSStatus;
491 }
492 unsafe { SecKeychainCopySettings(keychain, out_settings) }
493 }
494
495 #[doc(alias = "SecKeychainUnlock")]
513 #[cfg(feature = "SecBase")]
514 #[deprecated = "SecKeychain is deprecated"]
515 #[inline]
516 pub unsafe fn unlock(
517 keychain: Option<&SecKeychain>,
518 password_length: u32,
519 password: *const c_void,
520 use_password: bool,
521 ) -> OSStatus {
522 extern "C-unwind" {
523 fn SecKeychainUnlock(
524 keychain: Option<&SecKeychain>,
525 password_length: u32,
526 password: *const c_void,
527 use_password: Boolean,
528 ) -> OSStatus;
529 }
530 unsafe { SecKeychainUnlock(keychain, password_length, password, use_password as _) }
531 }
532
533 #[doc(alias = "SecKeychainLock")]
539 #[cfg(feature = "SecBase")]
540 #[deprecated = "SecKeychain is deprecated"]
541 #[inline]
542 pub unsafe fn lock(keychain: Option<&SecKeychain>) -> OSStatus {
543 extern "C-unwind" {
544 fn SecKeychainLock(keychain: Option<&SecKeychain>) -> OSStatus;
545 }
546 unsafe { SecKeychainLock(keychain) }
547 }
548
549 #[doc(alias = "SecKeychainLockAll")]
553 #[deprecated = "SecKeychain is deprecated"]
554 #[inline]
555 pub unsafe fn lock_all() -> OSStatus {
556 extern "C-unwind" {
557 fn SecKeychainLockAll() -> OSStatus;
558 }
559 unsafe { SecKeychainLockAll() }
560 }
561
562 #[doc(alias = "SecKeychainCopyDefault")]
572 #[cfg(feature = "SecBase")]
573 #[deprecated = "SecKeychain is deprecated"]
574 #[inline]
575 pub unsafe fn copy_default(keychain: NonNull<*mut SecKeychain>) -> OSStatus {
576 extern "C-unwind" {
577 fn SecKeychainCopyDefault(keychain: NonNull<*mut SecKeychain>) -> OSStatus;
578 }
579 unsafe { SecKeychainCopyDefault(keychain) }
580 }
581
582 #[doc(alias = "SecKeychainSetDefault")]
588 #[cfg(feature = "SecBase")]
589 #[deprecated = "SecKeychain is deprecated"]
590 #[inline]
591 pub unsafe fn set_default(keychain: Option<&SecKeychain>) -> OSStatus {
592 extern "C-unwind" {
593 fn SecKeychainSetDefault(keychain: Option<&SecKeychain>) -> OSStatus;
594 }
595 unsafe { SecKeychainSetDefault(keychain) }
596 }
597
598 #[doc(alias = "SecKeychainCopySearchList")]
608 #[deprecated = "SecKeychain is deprecated"]
609 #[inline]
610 pub unsafe fn copy_search_list(search_list: NonNull<*const CFArray>) -> OSStatus {
611 extern "C-unwind" {
612 fn SecKeychainCopySearchList(search_list: NonNull<*const CFArray>) -> OSStatus;
613 }
614 unsafe { SecKeychainCopySearchList(search_list) }
615 }
616
617 #[doc(alias = "SecKeychainSetSearchList")]
627 #[deprecated = "SecKeychain is deprecated"]
628 #[inline]
629 pub unsafe fn set_search_list(search_list: &CFArray) -> OSStatus {
630 extern "C-unwind" {
631 fn SecKeychainSetSearchList(search_list: &CFArray) -> OSStatus;
632 }
633 unsafe { SecKeychainSetSearchList(search_list) }
634 }
635}
636
637#[repr(transparent)]
640#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
641pub struct SecPreferencesDomain(pub c_int);
642impl SecPreferencesDomain {
643 #[doc(alias = "kSecPreferencesDomainUser")]
644 pub const User: Self = Self(0);
645 #[doc(alias = "kSecPreferencesDomainSystem")]
646 pub const System: Self = Self(1);
647 #[doc(alias = "kSecPreferencesDomainCommon")]
648 pub const Common: Self = Self(2);
649 #[doc(alias = "kSecPreferencesDomainDynamic")]
650 pub const Dynamic: Self = Self(3);
651}
652
653#[cfg(feature = "objc2")]
654unsafe impl Encode for SecPreferencesDomain {
655 const ENCODING: Encoding = c_int::ENCODING;
656}
657
658#[cfg(feature = "objc2")]
659unsafe impl RefEncode for SecPreferencesDomain {
660 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
661}
662
663#[cfg(feature = "SecBase")]
664impl SecKeychain {
665 #[doc(alias = "SecKeychainCopyDomainDefault")]
669 #[cfg(feature = "SecBase")]
670 #[deprecated = "SecKeychain is deprecated"]
671 #[inline]
672 pub unsafe fn copy_domain_default(
673 domain: SecPreferencesDomain,
674 keychain: NonNull<*mut SecKeychain>,
675 ) -> OSStatus {
676 extern "C-unwind" {
677 fn SecKeychainCopyDomainDefault(
678 domain: SecPreferencesDomain,
679 keychain: NonNull<*mut SecKeychain>,
680 ) -> OSStatus;
681 }
682 unsafe { SecKeychainCopyDomainDefault(domain, keychain) }
683 }
684
685 #[doc(alias = "SecKeychainSetDomainDefault")]
686 #[cfg(feature = "SecBase")]
687 #[deprecated = "SecKeychain is deprecated"]
688 #[inline]
689 pub unsafe fn set_domain_default(
690 domain: SecPreferencesDomain,
691 keychain: Option<&SecKeychain>,
692 ) -> OSStatus {
693 extern "C-unwind" {
694 fn SecKeychainSetDomainDefault(
695 domain: SecPreferencesDomain,
696 keychain: Option<&SecKeychain>,
697 ) -> OSStatus;
698 }
699 unsafe { SecKeychainSetDomainDefault(domain, keychain) }
700 }
701
702 #[doc(alias = "SecKeychainCopyDomainSearchList")]
706 #[deprecated = "SecKeychain is deprecated"]
707 #[inline]
708 pub unsafe fn copy_domain_search_list(
709 domain: SecPreferencesDomain,
710 search_list: NonNull<*const CFArray>,
711 ) -> OSStatus {
712 extern "C-unwind" {
713 fn SecKeychainCopyDomainSearchList(
714 domain: SecPreferencesDomain,
715 search_list: NonNull<*const CFArray>,
716 ) -> OSStatus;
717 }
718 unsafe { SecKeychainCopyDomainSearchList(domain, search_list) }
719 }
720
721 #[doc(alias = "SecKeychainSetDomainSearchList")]
725 #[deprecated = "SecKeychain is deprecated"]
726 #[inline]
727 pub unsafe fn set_domain_search_list(
728 domain: SecPreferencesDomain,
729 search_list: &CFArray,
730 ) -> OSStatus {
731 extern "C-unwind" {
732 fn SecKeychainSetDomainSearchList(
733 domain: SecPreferencesDomain,
734 search_list: &CFArray,
735 ) -> OSStatus;
736 }
737 unsafe { SecKeychainSetDomainSearchList(domain, search_list) }
738 }
739
740 #[doc(alias = "SecKeychainSetPreferenceDomain")]
741 #[deprecated = "SecKeychain is deprecated"]
742 #[inline]
743 pub unsafe fn set_preference_domain(domain: SecPreferencesDomain) -> OSStatus {
744 extern "C-unwind" {
745 fn SecKeychainSetPreferenceDomain(domain: SecPreferencesDomain) -> OSStatus;
746 }
747 unsafe { SecKeychainSetPreferenceDomain(domain) }
748 }
749
750 #[doc(alias = "SecKeychainGetPreferenceDomain")]
754 #[deprecated = "SecKeychain is deprecated"]
755 #[inline]
756 pub unsafe fn preference_domain(domain: NonNull<SecPreferencesDomain>) -> OSStatus {
757 extern "C-unwind" {
758 fn SecKeychainGetPreferenceDomain(domain: NonNull<SecPreferencesDomain>) -> OSStatus;
759 }
760 unsafe { SecKeychainGetPreferenceDomain(domain) }
761 }
762
763 #[doc(alias = "SecKeychainGetStatus")]
775 #[cfg(feature = "SecBase")]
776 #[deprecated = "SecKeychain is deprecated"]
777 #[inline]
778 pub unsafe fn status(
779 keychain: Option<&SecKeychain>,
780 keychain_status: NonNull<SecKeychainStatus>,
781 ) -> OSStatus {
782 extern "C-unwind" {
783 fn SecKeychainGetStatus(
784 keychain: Option<&SecKeychain>,
785 keychain_status: NonNull<SecKeychainStatus>,
786 ) -> OSStatus;
787 }
788 unsafe { SecKeychainGetStatus(keychain, keychain_status) }
789 }
790
791 #[doc(alias = "SecKeychainGetPath")]
806 #[cfg(feature = "SecBase")]
807 #[deprecated = "SecKeychain is deprecated"]
808 #[inline]
809 pub unsafe fn path(
810 keychain: Option<&SecKeychain>,
811 io_path_length: NonNull<u32>,
812 path_name: NonNull<c_char>,
813 ) -> OSStatus {
814 extern "C-unwind" {
815 fn SecKeychainGetPath(
816 keychain: Option<&SecKeychain>,
817 io_path_length: NonNull<u32>,
818 path_name: NonNull<c_char>,
819 ) -> OSStatus;
820 }
821 unsafe { SecKeychainGetPath(keychain, io_path_length, path_name) }
822 }
823
824 #[doc(alias = "SecKeychainAttributeInfoForItemID")]
840 #[cfg(feature = "SecBase")]
841 #[deprecated = "SecKeychain is deprecated"]
842 #[inline]
843 pub unsafe fn attribute_info_for_item_id(
844 keychain: Option<&SecKeychain>,
845 item_id: u32,
846 info: NonNull<*mut SecKeychainAttributeInfo>,
847 ) -> OSStatus {
848 extern "C-unwind" {
849 fn SecKeychainAttributeInfoForItemID(
850 keychain: Option<&SecKeychain>,
851 item_id: u32,
852 info: NonNull<*mut SecKeychainAttributeInfo>,
853 ) -> OSStatus;
854 }
855 unsafe { SecKeychainAttributeInfoForItemID(keychain, item_id, info) }
856 }
857
858 #[doc(alias = "SecKeychainFreeAttributeInfo")]
868 #[cfg(feature = "SecBase")]
869 #[deprecated = "SecKeychain is deprecated"]
870 #[inline]
871 pub unsafe fn free_attribute_info(info: NonNull<SecKeychainAttributeInfo>) -> OSStatus {
872 extern "C-unwind" {
873 fn SecKeychainFreeAttributeInfo(info: NonNull<SecKeychainAttributeInfo>) -> OSStatus;
874 }
875 unsafe { SecKeychainFreeAttributeInfo(info) }
876 }
877}
878
879#[deprecated = "SecKeychain is deprecated"]
899#[cfg(all(feature = "SecBase", feature = "libc"))]
900pub type SecKeychainCallback = Option<
901 unsafe extern "C-unwind" fn(
902 SecKeychainEvent,
903 NonNull<SecKeychainCallbackInfo>,
904 *mut c_void,
905 ) -> OSStatus,
906>;
907
908#[cfg(feature = "SecBase")]
909impl SecKeychain {
910 #[doc(alias = "SecKeychainAddCallback")]
925 #[cfg(all(feature = "SecBase", feature = "libc"))]
926 #[deprecated = "SecKeychain is deprecated"]
927 #[inline]
928 pub unsafe fn add_callback(
929 callback_function: SecKeychainCallback,
930 event_mask: SecKeychainEventMask,
931 user_context: *mut c_void,
932 ) -> OSStatus {
933 extern "C-unwind" {
934 fn SecKeychainAddCallback(
935 callback_function: SecKeychainCallback,
936 event_mask: SecKeychainEventMask,
937 user_context: *mut c_void,
938 ) -> OSStatus;
939 }
940 unsafe { SecKeychainAddCallback(callback_function, event_mask, user_context) }
941 }
942
943 #[doc(alias = "SecKeychainRemoveCallback")]
953 #[cfg(all(feature = "SecBase", feature = "libc"))]
954 #[deprecated = "SecKeychain is deprecated"]
955 #[inline]
956 pub unsafe fn remove_callback(callback_function: SecKeychainCallback) -> OSStatus {
957 extern "C-unwind" {
958 fn SecKeychainRemoveCallback(callback_function: SecKeychainCallback) -> OSStatus;
959 }
960 unsafe { SecKeychainRemoveCallback(callback_function) }
961 }
962
963 #[doc(alias = "SecKeychainAddInternetPassword")]
1008 #[cfg(feature = "SecBase")]
1009 #[deprecated = "SecKeychain is deprecated"]
1010 #[inline]
1011 pub unsafe fn add_internet_password(
1012 keychain: Option<&SecKeychain>,
1013 server_name_length: u32,
1014 server_name: *const c_char,
1015 security_domain_length: u32,
1016 security_domain: *const c_char,
1017 account_name_length: u32,
1018 account_name: *const c_char,
1019 path_length: u32,
1020 path: *const c_char,
1021 port: u16,
1022 protocol: SecProtocolType,
1023 authentication_type: SecAuthenticationType,
1024 password_length: u32,
1025 password_data: NonNull<c_void>,
1026 item_ref: *mut *mut SecKeychainItem,
1027 ) -> OSStatus {
1028 extern "C-unwind" {
1029 fn SecKeychainAddInternetPassword(
1030 keychain: Option<&SecKeychain>,
1031 server_name_length: u32,
1032 server_name: *const c_char,
1033 security_domain_length: u32,
1034 security_domain: *const c_char,
1035 account_name_length: u32,
1036 account_name: *const c_char,
1037 path_length: u32,
1038 path: *const c_char,
1039 port: u16,
1040 protocol: SecProtocolType,
1041 authentication_type: SecAuthenticationType,
1042 password_length: u32,
1043 password_data: NonNull<c_void>,
1044 item_ref: *mut *mut SecKeychainItem,
1045 ) -> OSStatus;
1046 }
1047 unsafe {
1048 SecKeychainAddInternetPassword(
1049 keychain,
1050 server_name_length,
1051 server_name,
1052 security_domain_length,
1053 security_domain,
1054 account_name_length,
1055 account_name,
1056 path_length,
1057 path,
1058 port,
1059 protocol,
1060 authentication_type,
1061 password_length,
1062 password_data,
1063 item_ref,
1064 )
1065 }
1066 }
1067
1068 #[doc(alias = "SecKeychainFindInternetPassword")]
1115 #[cfg(feature = "SecBase")]
1116 #[deprecated = "SecKeychain is deprecated"]
1117 #[inline]
1118 pub unsafe fn find_internet_password(
1119 keychain_or_array: Option<&CFType>,
1120 server_name_length: u32,
1121 server_name: *const c_char,
1122 security_domain_length: u32,
1123 security_domain: *const c_char,
1124 account_name_length: u32,
1125 account_name: *const c_char,
1126 path_length: u32,
1127 path: *const c_char,
1128 port: u16,
1129 protocol: SecProtocolType,
1130 authentication_type: SecAuthenticationType,
1131 password_length: *mut u32,
1132 password_data: *mut *mut c_void,
1133 item_ref: *mut *mut SecKeychainItem,
1134 ) -> OSStatus {
1135 extern "C-unwind" {
1136 fn SecKeychainFindInternetPassword(
1137 keychain_or_array: Option<&CFType>,
1138 server_name_length: u32,
1139 server_name: *const c_char,
1140 security_domain_length: u32,
1141 security_domain: *const c_char,
1142 account_name_length: u32,
1143 account_name: *const c_char,
1144 path_length: u32,
1145 path: *const c_char,
1146 port: u16,
1147 protocol: SecProtocolType,
1148 authentication_type: SecAuthenticationType,
1149 password_length: *mut u32,
1150 password_data: *mut *mut c_void,
1151 item_ref: *mut *mut SecKeychainItem,
1152 ) -> OSStatus;
1153 }
1154 unsafe {
1155 SecKeychainFindInternetPassword(
1156 keychain_or_array,
1157 server_name_length,
1158 server_name,
1159 security_domain_length,
1160 security_domain,
1161 account_name_length,
1162 account_name,
1163 path_length,
1164 path,
1165 port,
1166 protocol,
1167 authentication_type,
1168 password_length,
1169 password_data,
1170 item_ref,
1171 )
1172 }
1173 }
1174
1175 #[doc(alias = "SecKeychainAddGenericPassword")]
1204 #[cfg(feature = "SecBase")]
1205 #[deprecated = "SecKeychain is deprecated"]
1206 #[inline]
1207 pub unsafe fn add_generic_password(
1208 keychain: Option<&SecKeychain>,
1209 service_name_length: u32,
1210 service_name: *const c_char,
1211 account_name_length: u32,
1212 account_name: *const c_char,
1213 password_length: u32,
1214 password_data: NonNull<c_void>,
1215 item_ref: *mut *mut SecKeychainItem,
1216 ) -> OSStatus {
1217 extern "C-unwind" {
1218 fn SecKeychainAddGenericPassword(
1219 keychain: Option<&SecKeychain>,
1220 service_name_length: u32,
1221 service_name: *const c_char,
1222 account_name_length: u32,
1223 account_name: *const c_char,
1224 password_length: u32,
1225 password_data: NonNull<c_void>,
1226 item_ref: *mut *mut SecKeychainItem,
1227 ) -> OSStatus;
1228 }
1229 unsafe {
1230 SecKeychainAddGenericPassword(
1231 keychain,
1232 service_name_length,
1233 service_name,
1234 account_name_length,
1235 account_name,
1236 password_length,
1237 password_data,
1238 item_ref,
1239 )
1240 }
1241 }
1242
1243 #[doc(alias = "SecKeychainFindGenericPassword")]
1274 #[cfg(feature = "SecBase")]
1275 #[deprecated = "SecKeychain is deprecated"]
1276 #[inline]
1277 pub unsafe fn find_generic_password(
1278 keychain_or_array: Option<&CFType>,
1279 service_name_length: u32,
1280 service_name: *const c_char,
1281 account_name_length: u32,
1282 account_name: *const c_char,
1283 password_length: *mut u32,
1284 password_data: *mut *mut c_void,
1285 item_ref: *mut *mut SecKeychainItem,
1286 ) -> OSStatus {
1287 extern "C-unwind" {
1288 fn SecKeychainFindGenericPassword(
1289 keychain_or_array: Option<&CFType>,
1290 service_name_length: u32,
1291 service_name: *const c_char,
1292 account_name_length: u32,
1293 account_name: *const c_char,
1294 password_length: *mut u32,
1295 password_data: *mut *mut c_void,
1296 item_ref: *mut *mut SecKeychainItem,
1297 ) -> OSStatus;
1298 }
1299 unsafe {
1300 SecKeychainFindGenericPassword(
1301 keychain_or_array,
1302 service_name_length,
1303 service_name,
1304 account_name_length,
1305 account_name,
1306 password_length,
1307 password_data,
1308 item_ref,
1309 )
1310 }
1311 }
1312
1313 #[doc(alias = "SecKeychainSetUserInteractionAllowed")]
1319 #[deprecated = "SecKeychain is deprecated"]
1320 #[inline]
1321 pub unsafe fn set_user_interaction_allowed(state: bool) -> OSStatus {
1322 extern "C-unwind" {
1323 fn SecKeychainSetUserInteractionAllowed(state: Boolean) -> OSStatus;
1324 }
1325 unsafe { SecKeychainSetUserInteractionAllowed(state as _) }
1326 }
1327
1328 #[doc(alias = "SecKeychainGetUserInteractionAllowed")]
1338 #[deprecated = "SecKeychain is deprecated"]
1339 #[inline]
1340 pub unsafe fn user_interaction_allowed(state: NonNull<Boolean>) -> OSStatus {
1341 extern "C-unwind" {
1342 fn SecKeychainGetUserInteractionAllowed(state: NonNull<Boolean>) -> OSStatus;
1343 }
1344 unsafe { SecKeychainGetUserInteractionAllowed(state) }
1345 }
1346
1347 #[doc(alias = "SecKeychainGetCSPHandle")]
1361 #[cfg(all(feature = "SecBase", feature = "cssmconfig", feature = "cssmtype"))]
1362 #[deprecated]
1363 #[inline]
1364 pub unsafe fn csp_handle(
1365 keychain: Option<&SecKeychain>,
1366 csp_handle: NonNull<CSSM_CSP_HANDLE>,
1367 ) -> OSStatus {
1368 extern "C-unwind" {
1369 fn SecKeychainGetCSPHandle(
1370 keychain: Option<&SecKeychain>,
1371 csp_handle: NonNull<CSSM_CSP_HANDLE>,
1372 ) -> OSStatus;
1373 }
1374 unsafe { SecKeychainGetCSPHandle(keychain, csp_handle) }
1375 }
1376
1377 #[doc(alias = "SecKeychainGetDLDBHandle")]
1391 #[cfg(all(feature = "SecBase", feature = "cssmconfig", feature = "cssmtype"))]
1392 #[deprecated]
1393 #[inline]
1394 pub unsafe fn dldb_handle(
1395 keychain: Option<&SecKeychain>,
1396 dldb_handle: NonNull<CSSM_DL_DB_HANDLE>,
1397 ) -> OSStatus {
1398 extern "C-unwind" {
1399 fn SecKeychainGetDLDBHandle(
1400 keychain: Option<&SecKeychain>,
1401 dldb_handle: NonNull<CSSM_DL_DB_HANDLE>,
1402 ) -> OSStatus;
1403 }
1404 unsafe { SecKeychainGetDLDBHandle(keychain, dldb_handle) }
1405 }
1406
1407 #[doc(alias = "SecKeychainCopyAccess")]
1419 #[cfg(feature = "SecBase")]
1420 #[deprecated = "SecKeychain is deprecated"]
1421 #[inline]
1422 pub unsafe fn copy_access(
1423 keychain: Option<&SecKeychain>,
1424 access: NonNull<*mut SecAccess>,
1425 ) -> OSStatus {
1426 extern "C-unwind" {
1427 fn SecKeychainCopyAccess(
1428 keychain: Option<&SecKeychain>,
1429 access: NonNull<*mut SecAccess>,
1430 ) -> OSStatus;
1431 }
1432 unsafe { SecKeychainCopyAccess(keychain, access) }
1433 }
1434
1435 #[doc(alias = "SecKeychainSetAccess")]
1443 #[cfg(feature = "SecBase")]
1444 #[deprecated = "SecKeychain is deprecated"]
1445 #[inline]
1446 pub unsafe fn set_access(keychain: Option<&SecKeychain>, access: &SecAccess) -> OSStatus {
1447 extern "C-unwind" {
1448 fn SecKeychainSetAccess(keychain: Option<&SecKeychain>, access: &SecAccess)
1449 -> OSStatus;
1450 }
1451 unsafe { SecKeychainSetAccess(keychain, access) }
1452 }
1453}
1454
1455extern "C-unwind" {
1456 #[deprecated = "renamed to `SecKeychain::version`"]
1457 pub fn SecKeychainGetVersion(return_vers: NonNull<u32>) -> OSStatus;
1458}
1459
1460extern "C-unwind" {
1461 #[cfg(feature = "SecBase")]
1462 #[deprecated = "renamed to `SecKeychain::open`"]
1463 pub fn SecKeychainOpen(
1464 path_name: NonNull<c_char>,
1465 keychain: NonNull<*mut SecKeychain>,
1466 ) -> OSStatus;
1467}
1468
1469#[cfg(feature = "SecBase")]
1470#[deprecated = "renamed to `SecKeychain::create`"]
1471#[inline]
1472pub unsafe extern "C-unwind" fn SecKeychainCreate(
1473 path_name: NonNull<c_char>,
1474 password_length: u32,
1475 password: *const c_void,
1476 prompt_user: bool,
1477 initial_access: Option<&SecAccess>,
1478 keychain: NonNull<*mut SecKeychain>,
1479) -> OSStatus {
1480 extern "C-unwind" {
1481 fn SecKeychainCreate(
1482 path_name: NonNull<c_char>,
1483 password_length: u32,
1484 password: *const c_void,
1485 prompt_user: Boolean,
1486 initial_access: Option<&SecAccess>,
1487 keychain: NonNull<*mut SecKeychain>,
1488 ) -> OSStatus;
1489 }
1490 unsafe {
1491 SecKeychainCreate(
1492 path_name,
1493 password_length,
1494 password,
1495 prompt_user as _,
1496 initial_access,
1497 keychain,
1498 )
1499 }
1500}
1501
1502extern "C-unwind" {
1503 #[cfg(feature = "SecBase")]
1504 #[deprecated = "renamed to `SecKeychain::delete`"]
1505 pub fn SecKeychainDelete(keychain_or_array: Option<&SecKeychain>) -> OSStatus;
1506}
1507
1508extern "C-unwind" {
1509 #[cfg(feature = "SecBase")]
1510 #[deprecated = "renamed to `SecKeychain::set_settings`"]
1511 pub fn SecKeychainSetSettings(
1512 keychain: Option<&SecKeychain>,
1513 new_settings: NonNull<SecKeychainSettings>,
1514 ) -> OSStatus;
1515}
1516
1517extern "C-unwind" {
1518 #[cfg(feature = "SecBase")]
1519 #[deprecated = "renamed to `SecKeychain::copy_settings`"]
1520 pub fn SecKeychainCopySettings(
1521 keychain: Option<&SecKeychain>,
1522 out_settings: NonNull<SecKeychainSettings>,
1523 ) -> OSStatus;
1524}
1525
1526#[cfg(feature = "SecBase")]
1527#[deprecated = "renamed to `SecKeychain::unlock`"]
1528#[inline]
1529pub unsafe extern "C-unwind" fn SecKeychainUnlock(
1530 keychain: Option<&SecKeychain>,
1531 password_length: u32,
1532 password: *const c_void,
1533 use_password: bool,
1534) -> OSStatus {
1535 extern "C-unwind" {
1536 fn SecKeychainUnlock(
1537 keychain: Option<&SecKeychain>,
1538 password_length: u32,
1539 password: *const c_void,
1540 use_password: Boolean,
1541 ) -> OSStatus;
1542 }
1543 unsafe { SecKeychainUnlock(keychain, password_length, password, use_password as _) }
1544}
1545
1546extern "C-unwind" {
1547 #[cfg(feature = "SecBase")]
1548 #[deprecated = "renamed to `SecKeychain::lock`"]
1549 pub fn SecKeychainLock(keychain: Option<&SecKeychain>) -> OSStatus;
1550}
1551
1552extern "C-unwind" {
1553 #[deprecated = "renamed to `SecKeychain::lock_all`"]
1554 pub fn SecKeychainLockAll() -> OSStatus;
1555}
1556
1557extern "C-unwind" {
1558 #[cfg(feature = "SecBase")]
1559 #[deprecated = "renamed to `SecKeychain::copy_default`"]
1560 pub fn SecKeychainCopyDefault(keychain: NonNull<*mut SecKeychain>) -> OSStatus;
1561}
1562
1563extern "C-unwind" {
1564 #[cfg(feature = "SecBase")]
1565 #[deprecated = "renamed to `SecKeychain::set_default`"]
1566 pub fn SecKeychainSetDefault(keychain: Option<&SecKeychain>) -> OSStatus;
1567}
1568
1569extern "C-unwind" {
1570 #[deprecated = "renamed to `SecKeychain::copy_search_list`"]
1571 pub fn SecKeychainCopySearchList(search_list: NonNull<*const CFArray>) -> OSStatus;
1572}
1573
1574extern "C-unwind" {
1575 #[deprecated = "renamed to `SecKeychain::set_search_list`"]
1576 pub fn SecKeychainSetSearchList(search_list: &CFArray) -> OSStatus;
1577}
1578
1579extern "C-unwind" {
1580 #[cfg(feature = "SecBase")]
1581 #[deprecated = "renamed to `SecKeychain::copy_domain_default`"]
1582 pub fn SecKeychainCopyDomainDefault(
1583 domain: SecPreferencesDomain,
1584 keychain: NonNull<*mut SecKeychain>,
1585 ) -> OSStatus;
1586}
1587
1588extern "C-unwind" {
1589 #[cfg(feature = "SecBase")]
1590 #[deprecated = "renamed to `SecKeychain::set_domain_default`"]
1591 pub fn SecKeychainSetDomainDefault(
1592 domain: SecPreferencesDomain,
1593 keychain: Option<&SecKeychain>,
1594 ) -> OSStatus;
1595}
1596
1597extern "C-unwind" {
1598 #[deprecated = "renamed to `SecKeychain::copy_domain_search_list`"]
1599 pub fn SecKeychainCopyDomainSearchList(
1600 domain: SecPreferencesDomain,
1601 search_list: NonNull<*const CFArray>,
1602 ) -> OSStatus;
1603}
1604
1605extern "C-unwind" {
1606 #[deprecated = "renamed to `SecKeychain::set_domain_search_list`"]
1607 pub fn SecKeychainSetDomainSearchList(
1608 domain: SecPreferencesDomain,
1609 search_list: &CFArray,
1610 ) -> OSStatus;
1611}
1612
1613extern "C-unwind" {
1614 #[deprecated = "renamed to `SecKeychain::set_preference_domain`"]
1615 pub fn SecKeychainSetPreferenceDomain(domain: SecPreferencesDomain) -> OSStatus;
1616}
1617
1618extern "C-unwind" {
1619 #[deprecated = "renamed to `SecKeychain::preference_domain`"]
1620 pub fn SecKeychainGetPreferenceDomain(domain: NonNull<SecPreferencesDomain>) -> OSStatus;
1621}
1622
1623extern "C-unwind" {
1624 #[cfg(feature = "SecBase")]
1625 #[deprecated = "renamed to `SecKeychain::status`"]
1626 pub fn SecKeychainGetStatus(
1627 keychain: Option<&SecKeychain>,
1628 keychain_status: NonNull<SecKeychainStatus>,
1629 ) -> OSStatus;
1630}
1631
1632extern "C-unwind" {
1633 #[cfg(feature = "SecBase")]
1634 #[deprecated = "renamed to `SecKeychain::path`"]
1635 pub fn SecKeychainGetPath(
1636 keychain: Option<&SecKeychain>,
1637 io_path_length: NonNull<u32>,
1638 path_name: NonNull<c_char>,
1639 ) -> OSStatus;
1640}
1641
1642extern "C-unwind" {
1643 #[cfg(feature = "SecBase")]
1644 #[deprecated = "renamed to `SecKeychain::attribute_info_for_item_id`"]
1645 pub fn SecKeychainAttributeInfoForItemID(
1646 keychain: Option<&SecKeychain>,
1647 item_id: u32,
1648 info: NonNull<*mut SecKeychainAttributeInfo>,
1649 ) -> OSStatus;
1650}
1651
1652extern "C-unwind" {
1653 #[cfg(feature = "SecBase")]
1654 #[deprecated = "renamed to `SecKeychain::free_attribute_info`"]
1655 pub fn SecKeychainFreeAttributeInfo(info: NonNull<SecKeychainAttributeInfo>) -> OSStatus;
1656}
1657
1658extern "C-unwind" {
1659 #[cfg(all(feature = "SecBase", feature = "libc"))]
1660 #[deprecated = "renamed to `SecKeychain::add_callback`"]
1661 pub fn SecKeychainAddCallback(
1662 callback_function: SecKeychainCallback,
1663 event_mask: SecKeychainEventMask,
1664 user_context: *mut c_void,
1665 ) -> OSStatus;
1666}
1667
1668extern "C-unwind" {
1669 #[cfg(all(feature = "SecBase", feature = "libc"))]
1670 #[deprecated = "renamed to `SecKeychain::remove_callback`"]
1671 pub fn SecKeychainRemoveCallback(callback_function: SecKeychainCallback) -> OSStatus;
1672}
1673
1674extern "C-unwind" {
1675 #[cfg(feature = "SecBase")]
1676 #[deprecated = "renamed to `SecKeychain::add_internet_password`"]
1677 pub fn SecKeychainAddInternetPassword(
1678 keychain: Option<&SecKeychain>,
1679 server_name_length: u32,
1680 server_name: *const c_char,
1681 security_domain_length: u32,
1682 security_domain: *const c_char,
1683 account_name_length: u32,
1684 account_name: *const c_char,
1685 path_length: u32,
1686 path: *const c_char,
1687 port: u16,
1688 protocol: SecProtocolType,
1689 authentication_type: SecAuthenticationType,
1690 password_length: u32,
1691 password_data: NonNull<c_void>,
1692 item_ref: *mut *mut SecKeychainItem,
1693 ) -> OSStatus;
1694}
1695
1696extern "C-unwind" {
1697 #[cfg(feature = "SecBase")]
1698 #[deprecated = "renamed to `SecKeychain::find_internet_password`"]
1699 pub fn SecKeychainFindInternetPassword(
1700 keychain_or_array: Option<&CFType>,
1701 server_name_length: u32,
1702 server_name: *const c_char,
1703 security_domain_length: u32,
1704 security_domain: *const c_char,
1705 account_name_length: u32,
1706 account_name: *const c_char,
1707 path_length: u32,
1708 path: *const c_char,
1709 port: u16,
1710 protocol: SecProtocolType,
1711 authentication_type: SecAuthenticationType,
1712 password_length: *mut u32,
1713 password_data: *mut *mut c_void,
1714 item_ref: *mut *mut SecKeychainItem,
1715 ) -> OSStatus;
1716}
1717
1718extern "C-unwind" {
1719 #[cfg(feature = "SecBase")]
1720 #[deprecated = "renamed to `SecKeychain::add_generic_password`"]
1721 pub fn SecKeychainAddGenericPassword(
1722 keychain: Option<&SecKeychain>,
1723 service_name_length: u32,
1724 service_name: *const c_char,
1725 account_name_length: u32,
1726 account_name: *const c_char,
1727 password_length: u32,
1728 password_data: NonNull<c_void>,
1729 item_ref: *mut *mut SecKeychainItem,
1730 ) -> OSStatus;
1731}
1732
1733extern "C-unwind" {
1734 #[cfg(feature = "SecBase")]
1735 #[deprecated = "renamed to `SecKeychain::find_generic_password`"]
1736 pub fn SecKeychainFindGenericPassword(
1737 keychain_or_array: Option<&CFType>,
1738 service_name_length: u32,
1739 service_name: *const c_char,
1740 account_name_length: u32,
1741 account_name: *const c_char,
1742 password_length: *mut u32,
1743 password_data: *mut *mut c_void,
1744 item_ref: *mut *mut SecKeychainItem,
1745 ) -> OSStatus;
1746}
1747
1748#[deprecated = "renamed to `SecKeychain::set_user_interaction_allowed`"]
1749#[inline]
1750pub unsafe extern "C-unwind" fn SecKeychainSetUserInteractionAllowed(state: bool) -> OSStatus {
1751 extern "C-unwind" {
1752 fn SecKeychainSetUserInteractionAllowed(state: Boolean) -> OSStatus;
1753 }
1754 unsafe { SecKeychainSetUserInteractionAllowed(state as _) }
1755}
1756
1757extern "C-unwind" {
1758 #[deprecated = "renamed to `SecKeychain::user_interaction_allowed`"]
1759 pub fn SecKeychainGetUserInteractionAllowed(state: NonNull<Boolean>) -> OSStatus;
1760}
1761
1762extern "C-unwind" {
1763 #[cfg(all(feature = "SecBase", feature = "cssmconfig", feature = "cssmtype"))]
1764 #[deprecated = "renamed to `SecKeychain::csp_handle`"]
1765 pub fn SecKeychainGetCSPHandle(
1766 keychain: Option<&SecKeychain>,
1767 csp_handle: NonNull<CSSM_CSP_HANDLE>,
1768 ) -> OSStatus;
1769}
1770
1771extern "C-unwind" {
1772 #[cfg(all(feature = "SecBase", feature = "cssmconfig", feature = "cssmtype"))]
1773 #[deprecated = "renamed to `SecKeychain::dldb_handle`"]
1774 pub fn SecKeychainGetDLDBHandle(
1775 keychain: Option<&SecKeychain>,
1776 dldb_handle: NonNull<CSSM_DL_DB_HANDLE>,
1777 ) -> OSStatus;
1778}
1779
1780extern "C-unwind" {
1781 #[cfg(feature = "SecBase")]
1782 #[deprecated = "renamed to `SecKeychain::copy_access`"]
1783 pub fn SecKeychainCopyAccess(
1784 keychain: Option<&SecKeychain>,
1785 access: NonNull<*mut SecAccess>,
1786 ) -> OSStatus;
1787}
1788
1789extern "C-unwind" {
1790 #[cfg(feature = "SecBase")]
1791 #[deprecated = "renamed to `SecKeychain::set_access`"]
1792 pub fn SecKeychainSetAccess(keychain: Option<&SecKeychain>, access: &SecAccess) -> OSStatus;
1793}