objc2-security 0.3.2

Bindings to the Security framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

extern "C" {
    /// Indicates that no padding will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingnonekey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingNoneKey: &'static CFString;
}

extern "C" {
    /// Indicates that PKCS1 padding will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs1key?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingPKCS1Key: &'static CFString;
}

extern "C" {
    /// Indicates that PKCS5 padding will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs5key?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingPKCS5Key: &'static CFString;
}

extern "C" {
    /// Indicates that PKCS7 padding will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingpkcs7key?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingPKCS7Key: &'static CFString;
}

extern "C" {
    /// Indicates that PKCS7 padding will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingoaepkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingOAEPKey: &'static CFString;
}

extern "C" {
    /// Indicates that no mode will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodenonekey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecModeNoneKey: &'static CFString;
}

extern "C" {
    /// Indicates that ECB mode will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodeecbkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecModeECBKey: &'static CFString;
}

extern "C" {
    /// Indicates that CBC mode will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodecbckey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecModeCBCKey: &'static CFString;
}

extern "C" {
    /// Indicates that CFB mode will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodecfbkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecModeCFBKey: &'static CFString;
}

extern "C" {
    /// Indicates that OFB mode will be used when encrypting or decrypting.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecmodeofbkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecModeOFBKey: &'static CFString;
}

extern "C" {
    /// This attribute holds the encryption key for the transform. (ReadOnly)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecencryptkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecEncryptKey: &'static CFString;
}

extern "C" {
    /// Key for setting padding.
    ///
    /// This key is optional.  If you do not supply a value for this key,
    /// an appropriate value will be supplied for you.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecpaddingkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecPaddingKey: &'static CFString;
}

extern "C" {
    /// Key for setting an initialization vector.
    ///
    /// This key is optional.  If you do not supply a
    /// value for this key, an appropriate value will be supplied for you.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecivkey?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecIVKey: &'static CFString;
}

extern "C" {
    /// Specifies the encryption mode.
    ///
    /// This key is optional.  If you do not supply this key,
    /// an appropriate value will be supplied for you.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecencryptionmode?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecEncryptionMode: &'static CFString;
}

extern "C" {
    /// Specifies the OAEP message length.
    ///
    /// This should be set to a CFNumberRef when the padding is set to OAEP,
    /// and a specific messages size is desired.   If unset the minimum padding
    /// will be added.   It is ignored when the padding mode is not OAEP.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepmessagelengthattributename?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecOAEPMessageLengthAttributeName: &'static CFString;
}

extern "C" {
    /// Specifies the OAEP encoding paramaters
    ///
    /// This should be set to a CFDataRef when the padding is set to OAEP.
    /// If unset a zero length CFDataRef is used.   It is ignored by non
    /// OAEP padding modes.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepencodingparametersattributename?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecOAEPEncodingParametersAttributeName: &'static CFString;
}

extern "C" {
    /// Specifies the OAEP MGF1 digest algorithm.
    ///
    /// This should be set to a digest algorithm when the padding is set to OAEP.
    /// If unset SHA1 is used.   It is ifnored by non OAEP padding modes.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/security/ksecoaepmgf1digestalgorithmattributename?language=objc)
    #[deprecated = "SecTransform is no longer supported"]
    pub static kSecOAEPMGF1DigestAlgorithmAttributeName: &'static CFString;
}

/// Creates an encryption SecTransform  object.
///
/// Parameter `keyRef`: The key for the encryption operation
///
/// Parameter `error`: A pointer to a CFErrorRef.  This pointer will be set
/// if an error occurred.  This value may be NULL if you
/// do not want an error returned.
///
/// Returns: A pointer to a SecTransformRef object.  This object must
/// be released with CFRelease when you are done with
/// it.  This function will return NULL if an error
/// occurred.
///
/// This function creates a transform which encrypts data.
///
/// # Safety
///
/// `error` must be a valid pointer or null.
#[cfg(all(feature = "SecBase", feature = "SecTransform"))]
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub unsafe extern "C-unwind" fn SecEncryptTransformCreate(
    key_ref: &SecKey,
    error: *mut *mut CFError,
) -> CFRetained<SecTransform> {
    extern "C-unwind" {
        fn SecEncryptTransformCreate(
            key_ref: &SecKey,
            error: *mut *mut CFError,
        ) -> Option<NonNull<SecTransform>>;
    }
    let ret = unsafe { SecEncryptTransformCreate(key_ref, error) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// Creates an encryption SecTransform  object.
///
/// Parameter `keyRef`: The key for the operation
///
/// Parameter `error`: A pointer to a CFErrorRef.  This pointer will be set
/// if an error occurred.  This value may be NULL if you
/// do not want an error returned.
///
/// Returns: A pointer to a SecTransformRef object.  This object must
/// be released with CFRelease when you are done with
/// it.  This function will return NULL if an error
/// occurred.
///
/// This function creates a transform which encrypts data.
///
/// # Safety
///
/// `error` must be a valid pointer or null.
#[cfg(all(feature = "SecBase", feature = "SecTransform"))]
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub unsafe extern "C-unwind" fn SecDecryptTransformCreate(
    key_ref: &SecKey,
    error: *mut *mut CFError,
) -> CFRetained<SecTransform> {
    extern "C-unwind" {
        fn SecDecryptTransformCreate(
            key_ref: &SecKey,
            error: *mut *mut CFError,
        ) -> Option<NonNull<SecTransform>>;
    }
    let ret = unsafe { SecDecryptTransformCreate(key_ref, error) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// Returns the CFTypeID for a decrypt transform.
///
/// Returns: the CFTypeID
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub extern "C-unwind" fn SecDecryptTransformGetTypeID() -> CFTypeID {
    extern "C-unwind" {
        fn SecDecryptTransformGetTypeID() -> CFTypeID;
    }
    unsafe { SecDecryptTransformGetTypeID() }
}

/// Returns the CFTypeID for a decrypt transform.
///
/// Returns: the CFTypeID
#[deprecated = "SecTransform is no longer supported"]
#[inline]
pub extern "C-unwind" fn SecEncryptTransformGetTypeID() -> CFTypeID {
    extern "C-unwind" {
        fn SecEncryptTransformGetTypeID() -> CFTypeID;
    }
    unsafe { SecEncryptTransformGetTypeID() }
}