Retrieves the data of a trusted app instance.


func SecTrustedApplicationCopyData(_ appRef: SecTrustedApplication, _ data: UnsafeMutablePointer<CFData?>) -> OSStatus



A trusted app from which to retrieve data. Use the SecTrustedApplicationCreateFromPath(_:_:) method to create a trusted app instance.


On return, points to an opaque data instance. Call the CFRelease method to release the data when you are finished using it.

Return Value


The trusted app instance created by the SecTrustedApplicationCreateFromPath(_:_:) method includes data that uniquely identifies the app, such as a cryptographic hash of the app. The operating system uses this data to verify that the app is unaltered since the trusted app instance was created. When an app requests access to an item in the keychain for which it is designated as a trusted app, the operating system checks this data before granting access.

Use the SecTrustedApplicationCopyData(_:_:) function to extract this data from the trusted app instance for storage or for transmission over the network. Use the SecTrustedApplicationSetData(_:_:) function to insert that data back into a trusted app instance. Note that this data is opaque: there’s no way to interpret it.

See Also

Trusted Applications

func SecTrustedApplicationCreateFromPath(UnsafePointer<Int8>?, UnsafeMutablePointer<SecTrustedApplication?>) -> OSStatus

Creates a trusted app instance based on the app at the given path in the file system.

func SecTrustedApplicationSetData(SecTrustedApplication, CFData) -> OSStatus

Sets the data of a given trusted app instance.

class SecTrustedApplication

An opaque type that contains information about a trusted app.

func SecTrustedApplicationGetTypeID() -> CFTypeID

Returns the unique identifier of the opaque type to which a trusted app instance belongs.