---
title: kSecClassKey
framework: security
role: symbol
role_heading: Global Variable
path: security/ksecclasskey
---

# kSecClassKey

The value that indicates a cryptographic key item.

## Declaration

```swift
let kSecClassKey: CFString
```

## Mentioned in

Storing Keys in the Keychain

## Discussion

Discussion The following keychain item attributes form the composite primary key of a cryptographic key item: kSecAttrAccessGroup (on macOS, this key only applies if you set kSecUseDataProtectionKeychain or kSecAttrSynchronizable to true) kSecAttrApplicationLabel kSecAttrApplicationTag kSecAttrEffectiveKeySize kSecAttrKeyClass kSecAttrKeySizeInBits kSecAttrKeyType kSecAttrSynchronizable (on iOS 14 and newer, iOS 11 newer, and watchOS 7 and newer) Calls to SecItemAdd(_:_:) that add a cryptographic key item with the same values for all of these attributes as an existing item result in errSecDuplicateItem. The following keychain item attributes apply to a cryptographic key item, and don’t form part of its composite primary key: kSecAttrAccess (macOS only) kSecAttrAccessible (on macOS, this key only applies if you set kSecUseDataProtectionKeychain or kSecAttrSynchronizable to true) kSecAttrLabel kSecAttrIsPermanent kSecAttrPRF kSecAttrSalt kSecAttrRounds kSecAttrCanEncrypt kSecAttrCanDecrypt kSecAttrCanDerive kSecAttrCanSign kSecAttrCanVerify kSecAttrCanWrap kSecAttrCanUnwrap
