---
title: "gss_aapl_initial_cred(_:_:_:_:_:)"
framework: GSS
role: symbol
role_heading: Function
platforms: [iOS 5.0+, iPadOS 5.0+, Mac Catalyst 13.1+, macOS 10.7+, visionOS 1.0+]
path: "gss/gss_aapl_initial_cred(_:_:_:_:_:)"
---

# gss_aapl_initial_cred(_:_:_:_:_:)

Acquires a new credential using a password or certificate.

## Declaration

```swift
func gss_aapl_initial_cred(_ desired_name: gss_name_t, _ desired_mech: gss_const_OID, _ attributes: CFDictionary?, _ output_cred_handle: UnsafeMutablePointer<gss_cred_id_t?>, _ error: UnsafeMutablePointer<Unmanaged<CFError>?>?) -> OM_uint32
```

## Parameters

- `desired_name`: The name to use to acquire the credential. Import the name using doc://com.apple.gss/documentation/GSS/gss_import_name(_:_:_:_:). Ensure that the mechanism specified by the desired_mech parameter supports the name type.
- `desired_mech`: The mechanism to use to acquire the credential, for example doc://com.apple.gss/documentation/GSS/GSS_KRB5_MECHANISM or doc://com.apple.gss/documentation/GSS/GSS_NTLM_MECHANISM. Use doc://com.apple.gss/documentation/GSS/gss_indicate_mechs(_:_:) to get a complete list of supported mechanisms.
- `attributes`: A dictionary that includes either the key doc://com.apple.gss/documentation/GSS/kGSSICPassword to specify a password or doc://com.apple.gss/documentation/GSS/kGSSICCertificate to name a certificate for use in acquiring the credential. It may also contain any of the other keys listed in Initial Credential Keys in doc://com.apple.gss/documentation/GSS/credential-management to optionally condition the operation.
- `output_cred_handle`: A credential pointer that the function sets to point at the new credential on success, or sets to doc://com.apple.gss/documentation/GSS/GSS_C_NO_CREDENTIAL on failure. Use doc://com.apple.gss/documentation/GSS/gss_release_cred(_:_:) or doc://com.apple.gss/documentation/GSS/gss_destroy_cred(_:_:) to release the credential’s memory when you are done with it.
- `error`: An error pointer that the function sets to point at a new error object if the function call fails. Pass NULL to ignore this error. When an error does exist, it describes the reason for the failure, and you are responsible for releasing it with CFRelease.

## Return Value

Return Value A status code set to GSS_S_COMPLETE if the call succeeds, or some other value indicating the reason for failure if not.

## Discussion

Discussion Don’t call this function on a UI update thread because it may block on network activity.

## See Also

### Acquisition

- [gss_acquire_cred(_:_:_:_:_:_:_:_:)](gss/gss_acquire_cred(_:_:_:_:_:_:_:_:).md)
- [gss_acquire_cred_with_password(_:_:_:_:_:_:_:_:_:)](gss/gss_acquire_cred_with_password(_:_:_:_:_:_:_:_:_:).md)
- [GSSCredentialCopyUUID(_:)](gss/gsscredentialcopyuuid(_:).md)
- [GSSCredentialCopyName(_:)](gss/gsscredentialcopyname(_:).md)
- [gss_pseudo_random(_:_:_:_:_:_:)](gss/gss_pseudo_random(_:_:_:_:_:_:).md)
