---
title: "canEncrypt(using:)"
framework: localauthentication
role: symbol
role_heading: Instance Method
path: "localauthentication/lapublickey/canencrypt(using:)"
---

# canEncrypt(using:)

Checks whether the algorithm you supply is valid for encrypting data with the key.

## Declaration

```swift
func canEncrypt(using algorithm: SecKeyAlgorithm) -> Bool
```

## Parameters

- `algorithm`: A cryptographic algorithm.

## Return Value

Return Value A Boolean value that indicates whether the algorithm you supply is valid for encrypting data with the key.

## See Also

### Checking algorithm support

- [canVerify(using:)](localauthentication/lapublickey/canverify(using:).md)
