Function

SecKeyCreateDecryptedData(_:_:_:_:)

Decrypts a block of data using a private key and specified algorithm.

Declaration

func SecKeyCreateDecryptedData(_ key: SecKey, _ algorithm: SecKeyAlgorithm, _ ciphertext: CFData, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> CFData?

Parameters

key

The private key to use to perform the decryption.

algorithm

The algorithm that was used to encrypt the data in the first place. Use one of the encryption algorithms listed in SecKeyAlgorithm. You can use the SecKeyIsAlgorithmSupported(_:_:_:) function to test that the key is suitable for the algorithm.

ciphertext

The data, produced with the corresponding public key and a call to the SecKeyCreateEncryptedData(_:_:_:_:) function, that you want to decrypt.

error

The address of a CFError object. If an error occurs, this is set to point at an error instance that describes the failure.

Return Value

The decrypted data or nil on failure.

See Also

Encryption

Using Keys for Encryption

Perform asymmetric and symmetric encryption and decryption using cryptographic keys.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software