encrypt(_:algorithm:completion:)
Encrypts the data you supply with a given algorithm.
Declaration
func encrypt(_ data: Data, algorithm: SecKeyAlgorithm, completion handler: @escaping @Sendable (Data?, (any Error)?) -> Void)func encrypt(_ data: Data, algorithm: SecKeyAlgorithm) async throws -> DataParameters
- data:
The data to encrypt.
- algorithm:
The algorithm to use to encrypt the data.
- handler:
A completion handler to call when the encryption operation completes.
dataThe encrypted data.
errorAn error object that indicates why the encryption failed, or
nilif it succeeded.