Contents

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 -> Data

Parameters

  • 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.

    data

    The encrypted data.

    error

    An error object that indicates why the encryption failed, or nil if it succeeded.

Discussion

See Also

Performing cryptographic operations