<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecRequirementCopyString(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecRequirementCopyString"
  },
  "title" : "SecRequirementCopyString(_:_:_:)"
}
-->

# SecRequirementCopyString(_:_:_:)

Converts a code requirement object into text form.

```
func SecRequirementCopyString(_ requirement: SecRequirement, _ flags: SecCSFlags, _ text: UnsafeMutablePointer<CFString?>) -> OSStatus
```

## Parameters

`requirement`

A valid code requirement object.

`flags`

Optional flags; see [`SecCSFlags`](/documentation/Security/SecCSFlags) for possible values. Pass [`kSecCSDefaultFlags`](/documentation/Security/SecCSFlags/kSecCSDefaultFlags) for standard behavior.

`text`

On return, a text representation of the code requirement.

## Return Value

A result code. See [Code Signing Services Result Codes](/documentation/Security/code-signing-services-result-codes).

## Discussion

If you use the [`SecRequirementCreateWithString(_:_:_:)`](/documentation/Security/SecRequirementCreateWithString(_:_:_:)) or [`SecRequirementCreateWithStringAndErrors(_:_:_:_:)`](/documentation/Security/SecRequirementCreateWithStringAndErrors(_:_:_:_:)) function to create a code requirement object from a text string and later use the [`SecRequirementCopyString(_:_:_:)`](/documentation/Security/SecRequirementCopyString(_:_:_:)) function to convert the object back to a string, the reconstituted text may differ in formatting, contain different source comments, and perform its validation functions in different order from the original. However, it is guaranteed that that the reconstituted text is functionally identical to the original. That is, recompiling the text using [`SecRequirementCreateWithString(_:_:_:)`](/documentation/Security/SecRequirementCreateWithString(_:_:_:)) will produce a code requirement object that behaves identically to the first one you created.

---

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)