Contents

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.

Mentioned in

Return Value

The decrypted data or NULL on failure. In Objective-C, call the CFRelease function to free the data’s memory when you are done with it.