<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/sec_protocol_metadata_create_secret(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@sec_protocol_metadata_create_secret"
  },
  "title" : "sec_protocol_metadata_create_secret(_:_:_:_:)"
}
-->

# sec_protocol_metadata_create_secret(_:_:_:_:)

```
func sec_protocol_metadata_create_secret(_ metadata: sec_protocol_metadata_t, _ label_len: Int, _ label: UnsafePointer<CChar>, _ exporter_length: Int) -> dispatch_data_t?
```

## Parameters

`metadata`

A `sec_protocol_metadata_t` instance.

`label_len`

Length of the KDF label string.

`label`

KDF label string.

`exporter_length`

Length of the secret to be exported.

## Return Value

Returns a dispatch_data_t object carrying the exported secret.

## Discussion

\abstract Export a secret, e.g., a cryptographic key, derived from the protocol metadata using a label string.

---

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)