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

# kSecReturnData

A key whose value is a Boolean that indicates whether or not to return item data.

```
let kSecReturnData: CFString
```

## Discussion

The corresponding value is of type <doc://com.apple.documentation/documentation/CoreFoundation/CFBoolean>. A value of <doc://com.apple.documentation/documentation/CoreFoundation/kCFBooleanTrue> indicates that the function needs to return the item’s data as a <doc://com.apple.documentation/documentation/CoreFoundation/CFData> object.

For keys and password items, data is secret (encrypted) and might require the user to enter a password for access. For key items, the resulting data has the same format as the return value of the function [`SecKeyCopyExternalRepresentation(_:_:)`](/documentation/Security/SecKeyCopyExternalRepresentation(_:_:)). However, the key data might not be extractable (for example, if it’s protected by the Secure Enclave), so prefer to use [`SecKeyCopyExternalRepresentation(_:_:)`](/documentation/Security/SecKeyCopyExternalRepresentation(_:_:)) for keys and check the `error` parameter if it returns `nil`.

---

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)