<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/kSecClassCertificate",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@kSecClassCertificate"
  },
  "title" : "kSecClassCertificate"
}
-->

# kSecClassCertificate

The value that indicates a certificate item.

```
let kSecClassCertificate: CFString
```

## Discussion

The following keychain item attributes form the composite primary key of a certificate password item:

- [`kSecAttrAccessGroup`](/documentation/Security/kSecAttrAccessGroup) (on macOS, this key only applies if you set [`kSecUseDataProtectionKeychain`](/documentation/Security/kSecUseDataProtectionKeychain) or [`kSecAttrSynchronizable`](/documentation/Security/kSecAttrSynchronizable) to <doc://com.apple.documentation/documentation/Swift/true>)
- [`kSecAttrCertificateType`](/documentation/Security/kSecAttrCertificateType)
- [`kSecAttrIssuer`](/documentation/Security/kSecAttrIssuer)
- [`kSecAttrSerialNumber`](/documentation/Security/kSecAttrSerialNumber)
- [`kSecAttrSynchronizable`](/documentation/Security/kSecAttrSynchronizable) (on iOS 14 and newer, iOS 11 newer, and watchOS 7 and newer)

Calls to [`SecItemAdd(_:_:)`](/documentation/Security/SecItemAdd(_:_:)) that add a certificate item with the same values for all of these attributes as an existing item result in [`errSecDuplicateItem`](/documentation/Security/errSecDuplicateItem).

The following keychain item attributes apply to a certificate item, and don’t form part of its composite primary key:

- [`kSecAttrAccess`](/documentation/Security/kSecAttrAccess) (macOS only)
- [`kSecAttrAccessible`](/documentation/Security/kSecAttrAccessible) (on macOS, this key only applies if you set [`kSecUseDataProtectionKeychain`](/documentation/Security/kSecUseDataProtectionKeychain) or [`kSecAttrSynchronizable`](/documentation/Security/kSecAttrSynchronizable) to <doc://com.apple.documentation/documentation/Swift/true>)
- [`kSecAttrCertificateEncoding`](/documentation/Security/kSecAttrCertificateEncoding)
- [`kSecAttrLabel`](/documentation/Security/kSecAttrLabel)
- [`kSecAttrSubject`](/documentation/Security/kSecAttrSubject)
- [`kSecAttrSubjectKeyID`](/documentation/Security/kSecAttrSubjectKeyID)
- [`kSecAttrPublicKeyHash`](/documentation/Security/kSecAttrPublicKeyHash)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)