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

# gss_inquire_cred_by_mech(_:_:_:_:_:_:_:)

Obtains per-mechanism information about a credential.

```
func gss_inquire_cred_by_mech(_ minor_status: UnsafeMutablePointer<OM_uint32>, _ cred_handle: gss_cred_id_t?, _ mech_type: gss_OID, _ cred_name: UnsafeMutablePointer<gss_name_t?>?, _ initiator_lifetime: UnsafeMutablePointer<OM_uint32>?, _ acceptor_lifetime: UnsafeMutablePointer<OM_uint32>?, _ cred_usage: UnsafeMutablePointer<gss_cred_usage_t>?) -> OM_uint32
```

## Parameters

`minor_status`

A pointer to the secondary status result that provides additional information in case of failure.

`cred_handle`

The credential to inspect. Use [`GSS_C_NO_CREDENTIAL`](/documentation/GSS/GSS_C_NO_CREDENTIAL) to inquire about the default initiator principal.

`mech_type`

The mechanism for which information should be returned.

`cred_name`

A pointer the function uses to return the name that the credential asserts. Use [`gss_release_name(_:_:)`](/documentation/GSS/gss_release_name(_:_:)) to free the name  object’s memory when you are done with it. Set the parameter to `NULL` to ignore this output.

`initiator_lifetime`

A pointer the function uses to return the number of seconds for which the credential will remain valid for initiating security contexts, or 0 if the credential is expired or if the credential’s usage mechanism is [`GSS_C_ACCEPT`](/documentation/GSS/GSS_C_ACCEPT). For credentials that do not support expiry, the function returns [`GSS_C_INDEFINITE`](/documentation/GSS/GSS_C_INDEFINITE). Set to `NULL` to ignore this output.

`acceptor_lifetime`

A pointer the function uses to return the number of seconds for which the credential will remain valid for accepting security contexts, or 0 if the credential is expired or if the credential’s usage mechanism is [`GSS_C_INITIATE`](/documentation/GSS/GSS_C_INITIATE). For credentials that do not support expiry, the function returns [`GSS_C_INDEFINITE`](/documentation/GSS/GSS_C_INDEFINITE). Set to `NULL` to ignore this output.

`cred_usage`

A pointer the function uses to return the credential usage. The value is one of [`GSS_C_ACCEPT`](/documentation/GSS/GSS_C_ACCEPT), [`GSS_C_INITIATE`](/documentation/GSS/GSS_C_INITIATE), or [`GSS_C_BOTH`](/documentation/GSS/GSS_C_BOTH). Set to `NULL` to ignore this output.

## Return Value

A status code set to [`GSS_S_COMPLETE`](/documentation/GSS/GSS_S_COMPLETE) on success. See [Function Status](/documentation/GSS/function-status) for a description of other status outputs.

---

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)