Function

SecTrustedApplicationCopyData

Retrieves the data of a trusted app instance.

Declaration

OSStatus SecTrustedApplicationCopyData(SecTrustedApplicationRef appRef, CFDataRef  _Nullable *data);

Parameters

appRef

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

data

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

Return Value

Discussion

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

SecTrustedApplicationCreateFromPath

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

Deprecated
SecTrustedApplicationSetData

Sets the data of a given trusted app instance.

Deprecated
SecTrustedApplicationRef

An opaque type that contains information about a trusted app.

SecTrustedApplicationGetTypeID

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