Function SecKeyCreateEncryptedData

Source
pub unsafe extern "C-unwind" fn SecKeyCreateEncryptedData(
    key: &SecKey,
    algorithm: &SecKeyAlgorithm,
    plaintext: &CFData,
    error: *mut *mut CFError,
) -> Option<CFRetained<CFData>>
Available on crate features SecBase and SecKey only.
Expand description

Encrypt a block of plaintext.

Parameter key: Public key with which to encrypt the data.

Parameter algorithm: One of SecKeyAlgorithm constants suitable to perform encryption with this key.

Parameter plaintext: The data to encrypt. The length and format of the data must conform to chosen algorithm, typically be less or equal to the value returned by SecKeyGetBlockSize().

Parameter error: On error, will be populated with an error object describing the failure. See “Security Error Codes” (SecBase.h).

Returns: The ciphertext represented as a CFData, or NULL on failure.

Encrypts plaintext data using specified key. The exact type of the operation including the format of input and output data is specified by encryption algorithm.