---
title: kSecAttrCanEncrypt
framework: security
role: symbol
role_heading: Global Variable
path: security/ksecattrcanencrypt
---

# kSecAttrCanEncrypt

A key whose value is a Boolean that indicates whether the cryptographic key can be used for encryption.

## Declaration

```swift
let kSecAttrCanEncrypt: CFString
```

## Mentioned in

Using Keys for Encryption

## Discussion

Discussion The corresponding value is of type CFBoolean and indicates whether this cryptographic key can be used to encrypt data. On key creation, if not explicitly specified, this attribute defaults to kCFBooleanFalse for private keys and kCFBooleanTrue for public keys.
