use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SecTrustResultType(pub u32);
impl SecTrustResultType {
#[doc(alias = "kSecTrustResultInvalid")]
pub const Invalid: Self = Self(0);
#[doc(alias = "kSecTrustResultProceed")]
pub const Proceed: Self = Self(1);
#[doc(alias = "kSecTrustResultConfirm")]
#[deprecated]
pub const Confirm: Self = Self(2);
#[doc(alias = "kSecTrustResultDeny")]
pub const Deny: Self = Self(3);
#[doc(alias = "kSecTrustResultUnspecified")]
pub const Unspecified: Self = Self(4);
#[doc(alias = "kSecTrustResultRecoverableTrustFailure")]
pub const RecoverableTrustFailure: Self = Self(5);
#[doc(alias = "kSecTrustResultFatalTrustFailure")]
pub const FatalTrustFailure: Self = Self(6);
#[doc(alias = "kSecTrustResultOtherError")]
pub const OtherError: Self = Self(7);
}
#[cfg(feature = "objc2")]
unsafe impl Encode for SecTrustResultType {
const ENCODING: Encoding = u32::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for SecTrustResultType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[doc(alias = "SecTrustRef")]
#[repr(C)]
pub struct SecTrust {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl SecTrust {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__SecTrust"> for SecTrust {}
);
extern "C" {
pub static kSecPropertyTypeTitle: &'static CFString;
}
extern "C" {
pub static kSecPropertyTypeError: &'static CFString;
}
extern "C" {
pub static kSecTrustEvaluationDate: &'static CFString;
}
extern "C" {
pub static kSecTrustExtendedValidation: &'static CFString;
}
extern "C" {
pub static kSecTrustOrganizationName: &'static CFString;
}
extern "C" {
pub static kSecTrustResultValue: &'static CFString;
}
extern "C" {
pub static kSecTrustRevocationChecked: &'static CFString;
}
extern "C" {
pub static kSecTrustRevocationValidUntilDate: &'static CFString;
}
extern "C" {
pub static kSecTrustCertificateTransparency: &'static CFString;
}
extern "C" {
#[deprecated]
pub static kSecTrustCertificateTransparencyWhiteList: &'static CFString;
}
extern "C" {
pub static kSecTrustQCStatements: &'static CFString;
}
extern "C" {
pub static kSecTrustQWACValidation: &'static CFString;
}
#[cfg(feature = "block2")]
pub type SecTrustCallback = *mut block2::DynBlock<dyn Fn(NonNull<SecTrust>, SecTrustResultType)>;
unsafe impl ConcreteType for SecTrust {
#[doc(alias = "SecTrustGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn SecTrustGetTypeID() -> CFTypeID;
}
unsafe { SecTrustGetTypeID() }
}
}
impl SecTrust {
#[doc(alias = "SecTrustCreateWithCertificates")]
#[inline]
pub unsafe fn create_with_certificates(
certificates: &CFType,
policies: Option<&CFType>,
trust: NonNull<*mut SecTrust>,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustCreateWithCertificates(
certificates: &CFType,
policies: Option<&CFType>,
trust: NonNull<*mut SecTrust>,
) -> OSStatus;
}
unsafe { SecTrustCreateWithCertificates(certificates, policies, trust) }
}
#[doc(alias = "SecTrustSetPolicies")]
#[inline]
pub unsafe fn set_policies(&self, policies: &CFType) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetPolicies(trust: &SecTrust, policies: &CFType) -> OSStatus;
}
unsafe { SecTrustSetPolicies(self, policies) }
}
#[doc(alias = "SecTrustCopyPolicies")]
#[inline]
pub unsafe fn copy_policies(&self, policies: NonNull<*const CFArray>) -> OSStatus {
extern "C-unwind" {
fn SecTrustCopyPolicies(
trust: &SecTrust,
policies: NonNull<*const CFArray>,
) -> OSStatus;
}
unsafe { SecTrustCopyPolicies(self, policies) }
}
#[doc(alias = "SecTrustSetNetworkFetchAllowed")]
#[inline]
pub unsafe fn set_network_fetch_allowed(&self, allow_fetch: bool) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetNetworkFetchAllowed(trust: &SecTrust, allow_fetch: Boolean) -> OSStatus;
}
unsafe { SecTrustSetNetworkFetchAllowed(self, allow_fetch as _) }
}
#[doc(alias = "SecTrustGetNetworkFetchAllowed")]
#[inline]
pub unsafe fn network_fetch_allowed(&self, allow_fetch: NonNull<Boolean>) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetNetworkFetchAllowed(
trust: &SecTrust,
allow_fetch: NonNull<Boolean>,
) -> OSStatus;
}
unsafe { SecTrustGetNetworkFetchAllowed(self, allow_fetch) }
}
#[doc(alias = "SecTrustSetAnchorCertificates")]
#[inline]
pub unsafe fn set_anchor_certificates(
&self,
anchor_certificates: Option<&CFArray>,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetAnchorCertificates(
trust: &SecTrust,
anchor_certificates: Option<&CFArray>,
) -> OSStatus;
}
unsafe { SecTrustSetAnchorCertificates(self, anchor_certificates) }
}
#[doc(alias = "SecTrustSetAnchorCertificatesOnly")]
#[inline]
pub unsafe fn set_anchor_certificates_only(&self, anchor_certificates_only: bool) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetAnchorCertificatesOnly(
trust: &SecTrust,
anchor_certificates_only: Boolean,
) -> OSStatus;
}
unsafe { SecTrustSetAnchorCertificatesOnly(self, anchor_certificates_only as _) }
}
#[doc(alias = "SecTrustCopyCustomAnchorCertificates")]
#[inline]
pub unsafe fn copy_custom_anchor_certificates(
&self,
anchors: NonNull<*const CFArray>,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustCopyCustomAnchorCertificates(
trust: &SecTrust,
anchors: NonNull<*const CFArray>,
) -> OSStatus;
}
unsafe { SecTrustCopyCustomAnchorCertificates(self, anchors) }
}
#[doc(alias = "SecTrustSetVerifyDate")]
#[inline]
pub unsafe fn set_verify_date(&self, verify_date: &CFDate) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetVerifyDate(trust: &SecTrust, verify_date: &CFDate) -> OSStatus;
}
unsafe { SecTrustSetVerifyDate(self, verify_date) }
}
#[doc(alias = "SecTrustGetVerifyTime")]
#[inline]
pub unsafe fn verify_time(&self) -> CFAbsoluteTime {
extern "C-unwind" {
fn SecTrustGetVerifyTime(trust: &SecTrust) -> CFAbsoluteTime;
}
unsafe { SecTrustGetVerifyTime(self) }
}
#[doc(alias = "SecTrustEvaluate")]
#[deprecated]
#[inline]
pub unsafe fn evaluate(&self, result: NonNull<SecTrustResultType>) -> OSStatus {
extern "C-unwind" {
fn SecTrustEvaluate(trust: &SecTrust, result: NonNull<SecTrustResultType>) -> OSStatus;
}
unsafe { SecTrustEvaluate(self, result) }
}
#[doc(alias = "SecTrustEvaluateWithError")]
#[must_use]
#[inline]
pub unsafe fn evaluate_with_error(&self, error: *mut *mut CFError) -> bool {
extern "C-unwind" {
fn SecTrustEvaluateWithError(trust: &SecTrust, error: *mut *mut CFError) -> bool;
}
unsafe { SecTrustEvaluateWithError(self, error) }
}
}
#[cfg(feature = "block2")]
pub type SecTrustWithErrorCallback =
*mut block2::DynBlock<dyn Fn(NonNull<SecTrust>, bool, *mut CFError)>;
impl SecTrust {
#[doc(alias = "SecTrustGetTrustResult")]
#[inline]
pub unsafe fn trust_result(&self, result: NonNull<SecTrustResultType>) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetTrustResult(
trust: &SecTrust,
result: NonNull<SecTrustResultType>,
) -> OSStatus;
}
unsafe { SecTrustGetTrustResult(self, result) }
}
#[doc(alias = "SecTrustCopyPublicKey")]
#[cfg(feature = "SecBase")]
#[deprecated]
#[inline]
pub unsafe fn public_key(&self) -> Option<CFRetained<SecKey>> {
extern "C-unwind" {
fn SecTrustCopyPublicKey(trust: &SecTrust) -> Option<NonNull<SecKey>>;
}
let ret = unsafe { SecTrustCopyPublicKey(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTrustCopyKey")]
#[cfg(feature = "SecBase")]
#[inline]
pub unsafe fn key(&self) -> Option<CFRetained<SecKey>> {
extern "C-unwind" {
fn SecTrustCopyKey(trust: &SecTrust) -> Option<NonNull<SecKey>>;
}
let ret = unsafe { SecTrustCopyKey(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTrustGetCertificateCount")]
#[inline]
pub unsafe fn certificate_count(&self) -> CFIndex {
extern "C-unwind" {
fn SecTrustGetCertificateCount(trust: &SecTrust) -> CFIndex;
}
unsafe { SecTrustGetCertificateCount(self) }
}
#[doc(alias = "SecTrustGetCertificateAtIndex")]
#[cfg(feature = "SecBase")]
#[deprecated]
#[inline]
pub unsafe fn certificate_at_index(&self, ix: CFIndex) -> Option<CFRetained<SecCertificate>> {
extern "C-unwind" {
fn SecTrustGetCertificateAtIndex(
trust: &SecTrust,
ix: CFIndex,
) -> Option<NonNull<SecCertificate>>;
}
let ret = unsafe { SecTrustGetCertificateAtIndex(self, ix) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[doc(alias = "SecTrustCopyExceptions")]
#[inline]
pub unsafe fn exceptions(&self) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn SecTrustCopyExceptions(trust: &SecTrust) -> Option<NonNull<CFData>>;
}
let ret = unsafe { SecTrustCopyExceptions(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTrustSetExceptions")]
#[inline]
pub unsafe fn set_exceptions(&self, exceptions: Option<&CFData>) -> bool {
extern "C-unwind" {
fn SecTrustSetExceptions(trust: &SecTrust, exceptions: Option<&CFData>) -> bool;
}
unsafe { SecTrustSetExceptions(self, exceptions) }
}
#[doc(alias = "SecTrustCopyProperties")]
#[deprecated]
#[inline]
pub unsafe fn properties(&self) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn SecTrustCopyProperties(trust: &SecTrust) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { SecTrustCopyProperties(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTrustCopyResult")]
#[inline]
pub unsafe fn result(&self) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn SecTrustCopyResult(trust: &SecTrust) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { SecTrustCopyResult(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "SecTrustSetOCSPResponse")]
#[inline]
pub unsafe fn set_ocsp_response(&self, response_data: Option<&CFType>) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetOCSPResponse(
trust: &SecTrust,
response_data: Option<&CFType>,
) -> OSStatus;
}
unsafe { SecTrustSetOCSPResponse(self, response_data) }
}
#[doc(alias = "SecTrustSetSignedCertificateTimestamps")]
#[inline]
pub unsafe fn set_signed_certificate_timestamps(
&self,
sct_array: Option<&CFArray>,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetSignedCertificateTimestamps(
trust: &SecTrust,
sct_array: Option<&CFArray>,
) -> OSStatus;
}
unsafe { SecTrustSetSignedCertificateTimestamps(self, sct_array) }
}
#[doc(alias = "SecTrustCopyCertificateChain")]
#[inline]
pub unsafe fn certificate_chain(&self) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn SecTrustCopyCertificateChain(trust: &SecTrust) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { SecTrustCopyCertificateChain(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[deprecated]
pub type SecTrustUserSetting = SecTrustResultType;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SecTrustOptionFlags(pub u32);
bitflags::bitflags! {
impl SecTrustOptionFlags: u32 {
#[doc(alias = "kSecTrustOptionAllowExpired")]
const AllowExpired = 0x00000001;
#[doc(alias = "kSecTrustOptionLeafIsCA")]
const LeafIsCA = 0x00000002;
#[doc(alias = "kSecTrustOptionFetchIssuerFromNet")]
const FetchIssuerFromNet = 0x00000004;
#[doc(alias = "kSecTrustOptionAllowExpiredRoot")]
const AllowExpiredRoot = 0x00000008;
#[doc(alias = "kSecTrustOptionRequireRevPerCert")]
const RequireRevPerCert = 0x00000010;
#[doc(alias = "kSecTrustOptionUseTrustSettings")]
const UseTrustSettings = 0x00000020;
#[doc(alias = "kSecTrustOptionImplicitAnchors")]
const ImplicitAnchors = 0x00000040;
}
}
#[cfg(feature = "objc2")]
unsafe impl Encode for SecTrustOptionFlags {
const ENCODING: Encoding = u32::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for SecTrustOptionFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl SecTrust {
#[doc(alias = "SecTrustSetOptions")]
#[inline]
pub unsafe fn set_options(&self, options: SecTrustOptionFlags) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetOptions(trust_ref: &SecTrust, options: SecTrustOptionFlags) -> OSStatus;
}
unsafe { SecTrustSetOptions(self, options) }
}
#[doc(alias = "SecTrustSetParameters")]
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated]
#[inline]
pub unsafe fn set_parameters(&self, action: CSSM_TP_ACTION, action_data: &CFData) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetParameters(
trust_ref: &SecTrust,
action: CSSM_TP_ACTION,
action_data: &CFData,
) -> OSStatus;
}
unsafe { SecTrustSetParameters(self, action, action_data) }
}
#[doc(alias = "SecTrustSetKeychains")]
#[deprecated]
#[inline]
pub unsafe fn set_keychains(&self, keychain_or_array: Option<&CFType>) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetKeychains(
trust: &SecTrust,
keychain_or_array: Option<&CFType>,
) -> OSStatus;
}
unsafe { SecTrustSetKeychains(self, keychain_or_array) }
}
#[doc(alias = "SecTrustGetResult")]
#[cfg(all(
feature = "SecAsn1Types",
feature = "cssmapple",
feature = "cssmconfig",
feature = "cssmtype"
))]
#[deprecated]
#[inline]
pub unsafe fn get_trust(
&self,
result: *mut SecTrustResultType,
cert_chain: *mut *const CFArray,
status_chain: *mut *mut CSSM_TP_APPLE_EVIDENCE_INFO,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetResult(
trust_ref: &SecTrust,
result: *mut SecTrustResultType,
cert_chain: *mut *const CFArray,
status_chain: *mut *mut CSSM_TP_APPLE_EVIDENCE_INFO,
) -> OSStatus;
}
unsafe { SecTrustGetResult(self, result, cert_chain, status_chain) }
}
#[doc(alias = "SecTrustGetCssmResult")]
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated]
#[inline]
pub unsafe fn cssm_result(
&self,
result: NonNull<CSSM_TP_VERIFY_CONTEXT_RESULT_PTR>,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetCssmResult(
trust: &SecTrust,
result: NonNull<CSSM_TP_VERIFY_CONTEXT_RESULT_PTR>,
) -> OSStatus;
}
unsafe { SecTrustGetCssmResult(self, result) }
}
#[doc(alias = "SecTrustGetCssmResultCode")]
#[deprecated]
#[inline]
pub unsafe fn cssm_result_code(&self, result_code: NonNull<OSStatus>) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetCssmResultCode(
trust: &SecTrust,
result_code: NonNull<OSStatus>,
) -> OSStatus;
}
unsafe { SecTrustGetCssmResultCode(self, result_code) }
}
#[doc(alias = "SecTrustGetTPHandle")]
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated]
#[inline]
pub unsafe fn tp_handle(&self, handle: NonNull<CSSM_TP_HANDLE>) -> OSStatus {
extern "C-unwind" {
fn SecTrustGetTPHandle(trust: &SecTrust, handle: NonNull<CSSM_TP_HANDLE>) -> OSStatus;
}
unsafe { SecTrustGetTPHandle(self, handle) }
}
#[doc(alias = "SecTrustCopyAnchorCertificates")]
#[inline]
pub unsafe fn copy_anchor_certificates(anchors: NonNull<*const CFArray>) -> OSStatus {
extern "C-unwind" {
fn SecTrustCopyAnchorCertificates(anchors: NonNull<*const CFArray>) -> OSStatus;
}
unsafe { SecTrustCopyAnchorCertificates(anchors) }
}
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::create_with_certificates`"]
pub fn SecTrustCreateWithCertificates(
certificates: &CFType,
policies: Option<&CFType>,
trust: NonNull<*mut SecTrust>,
) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_policies`"]
pub fn SecTrustSetPolicies(trust: &SecTrust, policies: &CFType) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::copy_policies`"]
pub fn SecTrustCopyPolicies(trust: &SecTrust, policies: NonNull<*const CFArray>) -> OSStatus;
}
#[deprecated = "renamed to `SecTrust::set_network_fetch_allowed`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustSetNetworkFetchAllowed(
trust: &SecTrust,
allow_fetch: bool,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetNetworkFetchAllowed(trust: &SecTrust, allow_fetch: Boolean) -> OSStatus;
}
unsafe { SecTrustSetNetworkFetchAllowed(trust, allow_fetch as _) }
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::network_fetch_allowed`"]
pub fn SecTrustGetNetworkFetchAllowed(
trust: &SecTrust,
allow_fetch: NonNull<Boolean>,
) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_anchor_certificates`"]
pub fn SecTrustSetAnchorCertificates(
trust: &SecTrust,
anchor_certificates: Option<&CFArray>,
) -> OSStatus;
}
#[deprecated = "renamed to `SecTrust::set_anchor_certificates_only`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustSetAnchorCertificatesOnly(
trust: &SecTrust,
anchor_certificates_only: bool,
) -> OSStatus {
extern "C-unwind" {
fn SecTrustSetAnchorCertificatesOnly(
trust: &SecTrust,
anchor_certificates_only: Boolean,
) -> OSStatus;
}
unsafe { SecTrustSetAnchorCertificatesOnly(trust, anchor_certificates_only as _) }
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::copy_custom_anchor_certificates`"]
pub fn SecTrustCopyCustomAnchorCertificates(
trust: &SecTrust,
anchors: NonNull<*const CFArray>,
) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_verify_date`"]
pub fn SecTrustSetVerifyDate(trust: &SecTrust, verify_date: &CFDate) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::verify_time`"]
pub fn SecTrustGetVerifyTime(trust: &SecTrust) -> CFAbsoluteTime;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::evaluate`"]
pub fn SecTrustEvaluate(trust: &SecTrust, result: NonNull<SecTrustResultType>) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::evaluate_with_error`"]
#[must_use]
pub fn SecTrustEvaluateWithError(trust: &SecTrust, error: *mut *mut CFError) -> bool;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::trust_result`"]
pub fn SecTrustGetTrustResult(
trust: &SecTrust,
result: NonNull<SecTrustResultType>,
) -> OSStatus;
}
#[cfg(feature = "SecBase")]
#[deprecated = "renamed to `SecTrust::public_key`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyPublicKey(
trust: &SecTrust,
) -> Option<CFRetained<SecKey>> {
extern "C-unwind" {
fn SecTrustCopyPublicKey(trust: &SecTrust) -> Option<NonNull<SecKey>>;
}
let ret = unsafe { SecTrustCopyPublicKey(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "SecBase")]
#[deprecated = "renamed to `SecTrust::key`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyKey(trust: &SecTrust) -> Option<CFRetained<SecKey>> {
extern "C-unwind" {
fn SecTrustCopyKey(trust: &SecTrust) -> Option<NonNull<SecKey>>;
}
let ret = unsafe { SecTrustCopyKey(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::certificate_count`"]
pub fn SecTrustGetCertificateCount(trust: &SecTrust) -> CFIndex;
}
#[cfg(feature = "SecBase")]
#[deprecated = "renamed to `SecTrust::certificate_at_index`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustGetCertificateAtIndex(
trust: &SecTrust,
ix: CFIndex,
) -> Option<CFRetained<SecCertificate>> {
extern "C-unwind" {
fn SecTrustGetCertificateAtIndex(
trust: &SecTrust,
ix: CFIndex,
) -> Option<NonNull<SecCertificate>>;
}
let ret = unsafe { SecTrustGetCertificateAtIndex(trust, ix) };
ret.map(|ret| unsafe { CFRetained::retain(ret) })
}
#[deprecated = "renamed to `SecTrust::exceptions`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyExceptions(
trust: &SecTrust,
) -> Option<CFRetained<CFData>> {
extern "C-unwind" {
fn SecTrustCopyExceptions(trust: &SecTrust) -> Option<NonNull<CFData>>;
}
let ret = unsafe { SecTrustCopyExceptions(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_exceptions`"]
pub fn SecTrustSetExceptions(trust: &SecTrust, exceptions: Option<&CFData>) -> bool;
}
#[deprecated = "renamed to `SecTrust::properties`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyProperties(
trust: &SecTrust,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn SecTrustCopyProperties(trust: &SecTrust) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { SecTrustCopyProperties(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `SecTrust::result`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyResult(
trust: &SecTrust,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn SecTrustCopyResult(trust: &SecTrust) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { SecTrustCopyResult(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_ocsp_response`"]
pub fn SecTrustSetOCSPResponse(trust: &SecTrust, response_data: Option<&CFType>) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_signed_certificate_timestamps`"]
pub fn SecTrustSetSignedCertificateTimestamps(
trust: &SecTrust,
sct_array: Option<&CFArray>,
) -> OSStatus;
}
#[deprecated = "renamed to `SecTrust::certificate_chain`"]
#[inline]
pub unsafe extern "C-unwind" fn SecTrustCopyCertificateChain(
trust: &SecTrust,
) -> Option<CFRetained<CFArray>> {
extern "C-unwind" {
fn SecTrustCopyCertificateChain(trust: &SecTrust) -> Option<NonNull<CFArray>>;
}
let ret = unsafe { SecTrustCopyCertificateChain(trust) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_options`"]
pub fn SecTrustSetOptions(trust_ref: &SecTrust, options: SecTrustOptionFlags) -> OSStatus;
}
extern "C-unwind" {
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated = "renamed to `SecTrust::set_parameters`"]
pub fn SecTrustSetParameters(
trust_ref: &SecTrust,
action: CSSM_TP_ACTION,
action_data: &CFData,
) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::set_keychains`"]
pub fn SecTrustSetKeychains(trust: &SecTrust, keychain_or_array: Option<&CFType>) -> OSStatus;
}
extern "C-unwind" {
#[cfg(all(
feature = "SecAsn1Types",
feature = "cssmapple",
feature = "cssmconfig",
feature = "cssmtype"
))]
#[deprecated = "renamed to `SecTrust::get_trust`"]
pub fn SecTrustGetResult(
trust_ref: &SecTrust,
result: *mut SecTrustResultType,
cert_chain: *mut *const CFArray,
status_chain: *mut *mut CSSM_TP_APPLE_EVIDENCE_INFO,
) -> OSStatus;
}
extern "C-unwind" {
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated = "renamed to `SecTrust::cssm_result`"]
pub fn SecTrustGetCssmResult(
trust: &SecTrust,
result: NonNull<CSSM_TP_VERIFY_CONTEXT_RESULT_PTR>,
) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::cssm_result_code`"]
pub fn SecTrustGetCssmResultCode(trust: &SecTrust, result_code: NonNull<OSStatus>) -> OSStatus;
}
extern "C-unwind" {
#[cfg(all(feature = "cssmconfig", feature = "cssmtype"))]
#[deprecated = "renamed to `SecTrust::tp_handle`"]
pub fn SecTrustGetTPHandle(trust: &SecTrust, handle: NonNull<CSSM_TP_HANDLE>) -> OSStatus;
}
extern "C-unwind" {
#[deprecated = "renamed to `SecTrust::copy_anchor_certificates`"]
pub fn SecTrustCopyAnchorCertificates(anchors: NonNull<*const CFArray>) -> OSStatus;
}