---
title: "SecIdentitySetSystemIdentity(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/secidentitysetsystemidentity(_:_:)"
---

# SecIdentitySetSystemIdentity(_:_:)

Assigns the system identity to be associated with a specified domain.

## Declaration

```swift
func SecIdentitySetSystemIdentity(_ domain: CFString, _ idRef: SecIdentity?) -> OSStatus
```

## Parameters

- `domain`: The domain to which the specified identity will be assigned, typically in reverse DNS notation, such as com.apple.security. You may also pass the values defined in doc://com.apple.security/documentation/Security/system-identity-domains.
- `idRef`: The identity to be assigned to the specified domain. Pass NULL to delete any currently-assigned identity for the specified domain; in this case, it is not an error if no identity exists for the specified domain.

## Return Value

Return Value A result code. See Security Framework Result Codes.

## Discussion

Discussion The caller must be running as root.
