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

# SecKeyGetCredentials

Returns an access credential for a key.

```
OSStatus SecKeyGetCredentials(SecKeyRef keyRef, CSSM_ACL_AUTHORIZATION_TAG operation, SecCredentialType credentialType, const CSSM_ACCESS_CREDENTIALS **outCredentials);
```

## Parameters

`keyRef`

The key for which you want an access credential.

`operation`

The type of operation to be performed with this key. Possible values are listed under “Authorization tag types” in `Security.framework/cssmtype.h`.

`credentialType`

The type of credential requested. See [`SecCredentialType`](/documentation/Security/SecCredentialType) for possible values.

`outCredentials`

On return, points to an access credential for the specified key. This pointer remains valid until the key reference is released. Do not attempt to modify or free this data.

## Return Value

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

## Discussion

An access credential is required as an input to a number of CSSM functions.

---

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)