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

# SecPolicySearchCreate

Creates a search object for finding policies.

```
OSStatus SecPolicySearchCreate(CSSM_CERT_TYPE certType, const SecAsn1Oid *policyOID, const SecAsn1Item *value, SecPolicySearchRef*searchRef);
```

## Parameters

`certType`

The type of certificates a policy uses, as defined in `Security.framework/cssmtype.h`. Permissible values are `CSSM_CERT_X_509v1`, `CSSM_CERT_X_509v2`, and `CSSM_CERT_X_509v3`. If you are unsure of the certificate type, use `CSSM_CERT_X_509v3`.

`policyOID`

A pointer to a BER-encoded policy object identifier that uniquely specifies the policy. See [Certificate, Key, and Trust Services](/documentation/Security/certificate-key-and-trust-services) for a list of policies and object identifiers provided by the AppleX509TP module.

`value`

A pointer to an optional, policy-defined value. The contents of this value depend on the policy object identifier specified. (Note that this parameter refers to the value stored in MDS and is not related to the `value` parameter of the [`SecPolicyGetValue`](/documentation/Security/SecPolicyGetValue) function.) Currently the function does not use this parameter; pass `NULL` for this pointer.

`searchRef`

On return, points to the newly created policy search object. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to release this object when you are finished with it.

## Return Value

A result code. See [Security Framework Result Codes](/documentation/Security/security-framework-result-codes).

## Discussion

You use the search object created by this function in subsequent calls to the [`SecPolicySearchCopyNext`](/documentation/Security/SecPolicySearchCopyNext) function to obtain trust policy objects. Policies are stored in the Module Directory Services (MDS) database. MDS is described in detail in “Part 8: Module Directory Service (MDS)” of *Common Security: CDSA and CSSM, version 2 (with corrigenda)* from The Open Group (<http://www.opengroup.org/security/cdsa.htm>).

---

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)