---
title: "CMMetadataCreateKeyFromIdentifierAsCFData(allocator:identifier:keyOut:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmmetadatacreatekeyfromidentifierascfdata(allocator:identifier:keyout:)"
---

# CMMetadataCreateKeyFromIdentifierAsCFData(allocator:identifier:keyOut:)

Creates a copy of the key by using an identifier, and results in a core foundation data object.

## Declaration

```swift
func CMMetadataCreateKeyFromIdentifierAsCFData(allocator: CFAllocator?, identifier: CFString, keyOut: UnsafeMutablePointer<CFData?>) -> OSStatus
```

## Parameters

- `allocator`: The allocator to use for creating the identifier.
- `identifier`: The identifier to be inspected.
- `keyOut`: Upon return, a pointer to the key data that was used to create the identifier.

## Return Value

Return Value If successful, a nonzero result code. See Metadata Identifier Error Codes.

## Discussion

Discussion The bytes in the CFData correspond to how they are serialized in the file.

## See Also

### Creating Metadata Identifiers

- [CMMetadataCreateIdentifierForKeyAndKeySpace(allocator:key:keySpace:identifierOut:)](coremedia/cmmetadatacreateidentifierforkeyandkeyspace(allocator:key:keyspace:identifierout:).md)
- [CMMetadataCreateKeyFromIdentifier(allocator:identifier:keyOut:)](coremedia/cmmetadatacreatekeyfromidentifier(allocator:identifier:keyout:).md)
- [CMMetadataCreateKeySpaceFromIdentifier(allocator:identifier:keySpaceOut:)](coremedia/cmmetadatacreatekeyspacefromidentifier(allocator:identifier:keyspaceout:).md)
